Skip to content

Commit

Permalink
Attempting Clicky reverse-proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingorski committed Sep 13, 2023
1 parent fbee8d1 commit 6becf7d
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 72 deletions.
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"ulid": "https://deno.land/x/ulid@v0.2.2/mod.ts"
},
"exclude": [
"cov/"
"cov/",
"static/56ac6c4e308a9.js"
],
"lint": {
"rules": {
Expand Down
142 changes: 72 additions & 70 deletions fresh.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,83 +2,85 @@
// This file SHOULD be checked into source version control.
// This file is automatically updated during development when running `dev.ts`.

import * as $0 from "./routes/_404.tsx";
import * as $1 from "./routes/_500.tsx";
import * as $2 from "./routes/_app.tsx";
import * as $3 from "./routes/_middleware.ts";
import * as $4 from "./routes/about.tsx";
import * as $5 from "./routes/account/_middleware.ts";
import * as $6 from "./routes/account/connectOAuth.ts";
import * as $7 from "./routes/account/delete.tsx";
import * as $8 from "./routes/account/gitHubCallback.ts";
import * as $9 from "./routes/account/index.tsx";
import * as $10 from "./routes/account/manage.ts";
import * as $11 from "./routes/account/sendVerificationEmail.ts";
import * as $12 from "./routes/account/upgrade.ts";
import * as $13 from "./routes/admin/_middleware.ts";
import * as $14 from "./routes/admin/emailTemplates.tsx";
import * as $15 from "./routes/admin/index.tsx";
import * as $16 from "./routes/api/stripe-webhooks.ts";
import * as $17 from "./routes/developerMagicLink.ts";
import * as $18 from "./routes/employer/_middleware.ts";
import * as $19 from "./routes/employer/delete.tsx";
import * as $20 from "./routes/employer/index.tsx";
import * as $21 from "./routes/employerCallback.ts";
import * as $22 from "./routes/employerSignIn.tsx";
import * as $23 from "./routes/gitHubCallback.ts";
import * as $24 from "./routes/index.tsx";
import * as $25 from "./routes/kv-insights/_middleware.ts";
import * as $26 from "./routes/signInOAuth.ts";
import * as $27 from "./routes/signin.tsx";
import * as $28 from "./routes/signout.ts";
import * as $29 from "./routes/start/developer/index.tsx";
import * as $30 from "./routes/start/developer/thanks.tsx";
import * as $31 from "./routes/start/employer/index.tsx";
import * as $32 from "./routes/start/employer/thanks.tsx";
import * as $33 from "./routes/start/index.tsx";
import * as $34 from "./routes/verifyEmail.ts";
import * as $0 from "./routes/335afc1fe2e63.ts";
import * as $1 from "./routes/_404.tsx";
import * as $2 from "./routes/_500.tsx";
import * as $3 from "./routes/_app.tsx";
import * as $4 from "./routes/_middleware.ts";
import * as $5 from "./routes/about.tsx";
import * as $6 from "./routes/account/_middleware.ts";
import * as $7 from "./routes/account/connectOAuth.ts";
import * as $8 from "./routes/account/delete.tsx";
import * as $9 from "./routes/account/gitHubCallback.ts";
import * as $10 from "./routes/account/index.tsx";
import * as $11 from "./routes/account/manage.ts";
import * as $12 from "./routes/account/sendVerificationEmail.ts";
import * as $13 from "./routes/account/upgrade.ts";
import * as $14 from "./routes/admin/_middleware.ts";
import * as $15 from "./routes/admin/emailTemplates.tsx";
import * as $16 from "./routes/admin/index.tsx";
import * as $17 from "./routes/api/stripe-webhooks.ts";
import * as $18 from "./routes/developerMagicLink.ts";
import * as $19 from "./routes/employer/_middleware.ts";
import * as $20 from "./routes/employer/delete.tsx";
import * as $21 from "./routes/employer/index.tsx";
import * as $22 from "./routes/employerCallback.ts";
import * as $23 from "./routes/employerSignIn.tsx";
import * as $24 from "./routes/gitHubCallback.ts";
import * as $25 from "./routes/index.tsx";
import * as $26 from "./routes/kv-insights/_middleware.ts";
import * as $27 from "./routes/signInOAuth.ts";
import * as $28 from "./routes/signin.tsx";
import * as $29 from "./routes/signout.ts";
import * as $30 from "./routes/start/developer/index.tsx";
import * as $31 from "./routes/start/developer/thanks.tsx";
import * as $32 from "./routes/start/employer/index.tsx";
import * as $33 from "./routes/start/employer/thanks.tsx";
import * as $34 from "./routes/start/index.tsx";
import * as $35 from "./routes/verifyEmail.ts";
import * as $$0 from "./islands/Chart.tsx";
import * as $$1 from "./islands/DeleteAccountButton.tsx";
import * as $$2 from "./islands/EntriesManagement.tsx";
import * as $$3 from "./islands/VerifyEmailButton.tsx";

const manifest = {
routes: {
"./routes/_404.tsx": $0,
"./routes/_500.tsx": $1,
"./routes/_app.tsx": $2,
"./routes/_middleware.ts": $3,
"./routes/about.tsx": $4,
"./routes/account/_middleware.ts": $5,
"./routes/account/connectOAuth.ts": $6,
"./routes/account/delete.tsx": $7,
"./routes/account/gitHubCallback.ts": $8,
"./routes/account/index.tsx": $9,
"./routes/account/manage.ts": $10,
"./routes/account/sendVerificationEmail.ts": $11,
"./routes/account/upgrade.ts": $12,
"./routes/admin/_middleware.ts": $13,
"./routes/admin/emailTemplates.tsx": $14,
"./routes/admin/index.tsx": $15,
"./routes/api/stripe-webhooks.ts": $16,
"./routes/developerMagicLink.ts": $17,
"./routes/employer/_middleware.ts": $18,
"./routes/employer/delete.tsx": $19,
"./routes/employer/index.tsx": $20,
"./routes/employerCallback.ts": $21,
"./routes/employerSignIn.tsx": $22,
"./routes/gitHubCallback.ts": $23,
"./routes/index.tsx": $24,
"./routes/kv-insights/_middleware.ts": $25,
"./routes/signInOAuth.ts": $26,
"./routes/signin.tsx": $27,
"./routes/signout.ts": $28,
"./routes/start/developer/index.tsx": $29,
"./routes/start/developer/thanks.tsx": $30,
"./routes/start/employer/index.tsx": $31,
"./routes/start/employer/thanks.tsx": $32,
"./routes/start/index.tsx": $33,
"./routes/verifyEmail.ts": $34,
"./routes/335afc1fe2e63.ts": $0,
"./routes/_404.tsx": $1,
"./routes/_500.tsx": $2,
"./routes/_app.tsx": $3,
"./routes/_middleware.ts": $4,
"./routes/about.tsx": $5,
"./routes/account/_middleware.ts": $6,
"./routes/account/connectOAuth.ts": $7,
"./routes/account/delete.tsx": $8,
"./routes/account/gitHubCallback.ts": $9,
"./routes/account/index.tsx": $10,
"./routes/account/manage.ts": $11,
"./routes/account/sendVerificationEmail.ts": $12,
"./routes/account/upgrade.ts": $13,
"./routes/admin/_middleware.ts": $14,
"./routes/admin/emailTemplates.tsx": $15,
"./routes/admin/index.tsx": $16,
"./routes/api/stripe-webhooks.ts": $17,
"./routes/developerMagicLink.ts": $18,
"./routes/employer/_middleware.ts": $19,
"./routes/employer/delete.tsx": $20,
"./routes/employer/index.tsx": $21,
"./routes/employerCallback.ts": $22,
"./routes/employerSignIn.tsx": $23,
"./routes/gitHubCallback.ts": $24,
"./routes/index.tsx": $25,
"./routes/kv-insights/_middleware.ts": $26,
"./routes/signInOAuth.ts": $27,
"./routes/signin.tsx": $28,
"./routes/signout.ts": $29,
"./routes/start/developer/index.tsx": $30,
"./routes/start/developer/thanks.tsx": $31,
"./routes/start/employer/index.tsx": $32,
"./routes/start/employer/thanks.tsx": $33,
"./routes/start/index.tsx": $34,
"./routes/verifyEmail.ts": $35,
},
islands: {
"./islands/Chart.tsx": $$0,
Expand Down
20 changes: 20 additions & 0 deletions routes/335afc1fe2e63.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* Reverse proxy for Clicky Beacon to enable analytics */
import { HandlerContext, Handlers } from "$fresh/server.ts";

export const handler: Handlers = {
async GET(req: Request, ctx: HandlerContext) {
const { host, protocol, search } = new URL(req.url);
const proxiedUrl = new URL("https://in.getclicky.com/in.php");
proxiedUrl.search = search;

const headers = new Headers();
headers.set("Host", proxiedUrl.hostname);
headers.set("X-Forwarded-Host", host);
headers.set("X-Forwarded-Proto", protocol);
headers.set("X-Forwarded-For", ctx.remoteAddr.hostname);

return await fetch(proxiedUrl, {
headers,
});
},
};
2 changes: 1 addition & 1 deletion routes/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function App(props: AppProps) {
employerSessionId={props.data?.employerSessionId}
sessionId={props.data?.sessionId}
/>
<script async data-id={CLICKY_SITE_ID} src="//static.getclicky.com/js">
<script async data-id={CLICKY_SITE_ID} src="/56ac6c4e308a9.js">
</script>
</body>
</html>
Expand Down
Loading

0 comments on commit 6becf7d

Please sign in to comment.