Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Proxy the Interactors website directly. #400

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

cowboyd
Copy link
Member

@cowboyd cowboyd commented Sep 20, 2024

Motivation

The Interactors website had been proxied by netlify in our Gatsby legacy site to interactors site also running on netlify. We want to cut out the middleman and serve the interactors site directly. This will not only be faster in the short term. It will also set us up long-term to use sitemaps to build the entire frontside.com statically.

// before
Deno(fs.com) -> Netlify(Gatsby) -> Netlify(Docusaurus)

// after
Deno(fs.com) -> Deno(Docusaurus)

Approach

This enhances proxy routes to take on serving static docusaurus sites. It does two things. 1) It accepts a root parameter which gives the root path on the proxy site that we start serving from. 2) we enhance the proxy generally so that if it receives a redirect to itself, then it will also proxy the redirect rather than go to the source site. In other words suppose we make this request.

GET https://localhost:8005/interactors

which delegates to

https://interactors.deno.dev/interactors

But that response with a redirect:

301: Moved Permanently
Location: https://interactors.deno.dev/interactors/home/

We don't want the browser to redirect there. Instead, we want it to redirect back to itself:

301: Moved Permanently
Location: https:/localhost:8005/interactors/home/

The Interactors website had been proxied by netlify, but we want to
take responsibility for serving it ourselves.

This enhances the proxy to take on serving static docusaurus sites.
Basically, it does two things, it accepts a `root` parameter which
gives the root path on the proxy site that we start serving from.

Also we enhance the proxy generally so that if it receives a redirect
to itelf, then it will also proxy the redirect rather than go to the
source site.
Copy link

netlify bot commented Sep 20, 2024

Deploy Preview for frontside canceled.

Name Link
🔨 Latest commit 66f77d4
🔍 Latest deploy log https://app.netlify.com/sites/frontside/deploys/66ed038dd3476f0008a86bb4

@cowboyd cowboyd merged commit f5dcc20 into production Sep 20, 2024
7 checks passed
@cowboyd cowboyd deleted the cl/proxy-interactors-website branch September 20, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants