Hello, I’ve been looking at Fly.io as a potential platform to host our micro-frontend apps on the same domain name. I’d like to get a better idea if it’s possible to setup a similar proxy architecture in front of multiple apps as what I’m used to on other platforms. Or what the Fly way is to do it.
Would it be possible to get an updated 2022 example or tutorial of how to run an nginx proxy in front of multiple apps connecting with a 6PN private network on Fly.io?
- I tried reading this blog article - Incoming! 6PN Private Networks · Fly
- And following this example - GitHub - fly-apps/nginx-cluster: A horizontally scalable NGINX caching cluster
- However, it’s failing this error:
2022-05-01T21:19:47Z [info]web | /fly/check-nodes.sh: line 12: dig: command not found
The setup
Four Fly apps: one proxy and three micro-frontends:
-
example-proxy
(nginx proxy) -
example-blog
(Node app) -
example-docs
(Python app) -
example-web
(Remix app)
Given the following URLs, the proxy would route traffic like:
example.com/blog → routes to example-blog
example.com/docs → routes to example-docs
example.com/* → routes everything else to example-web
Also, would it be possible to use the internal DNS name without having to inject the IP6 address in the nginx.conf and use the internal DNS records directly? Like:
upstream example-blog {
server example-blog.internal;
}
upstream example-docs {
server example-docs.internal;
}
upstream example-web {
server example-web.internal;
}
server {
listen 8080;
listen [::]:8080;
location /blog {
proxy_pass http://example-blog/;
}
location /docs {
proxy_pass http://example-docs/;
}
location / {
proxy_pass http://example-web/;
}
}