Ability to proxy unhandled requests to an upstream server #105
Replies: 5 comments
-
|
Beta Was this translation helpful? Give feedback.
-
re (4) : 404 is no issue as the upstream server will have a 404 handler. This site is a migration from a custom express app where only some of the URLs are handled by gatsby (and more as they get migrated across) re (3) : I could configure the nginx server to proxy every gatsby URL to Fastify and its fallback to proxy to my custom express server. However I think that Fastify can do everything that nginx does so its one less component to deploy, monitor and manage. I'll have a play with your Fastify branch and see what I can come up with. |
Beta Was this translation helpful? Give feedback.
-
I should also note that I also already have a envoy edge proxy which does ssl termination etc.. (via istio) |
Beta Was this translation helpful? Give feedback.
-
@moonmeister Since you just changed SSR/DSG to explicitly map the pages to routes in #68 it should be straightforward now to handle my case by replacing the 404 handler with a proxy |
Beta Was this translation helpful? Give feedback.
-
That would work with a custom implementation. I was also thinking we could possible implement a way to do that programmatically vs you having to do a complete custom implementation but I have a lot of other things I want to ship first. |
Beta Was this translation helpful? Give feedback.
-
moved from #68
I'm looking for a self hosted solution for SSR/DSG and came across this plugin. It seems to address most of my needs, however one thing I need is the ability to proxy unhandled requests to an upstream server.
Currently I am using gatsby 3 without ssr/dsg. I build a docker image using nginx. I use a plugin that generates explicit location directives for each index.html file, static file, and gatsby redirects, plus a final wildcard proxy_pass directive to send the remainder of the traffic upstream.
In order to switch to this plugin, I would need to make the following changes to this plugin:
a) in handleDsgSsr if the request is not for a page then make the handler fall through to a later handler (is this possible in fastly?)
b) in gatsby.ts allowing configuration of FastifyPlugin to be configured before handle404 where I can configure a proxy
Beta Was this translation helpful? Give feedback.
All reactions