SSL for Custom Domains

We already have a NextJs app deployed on AWS. Can we just use fly as reverse proxy which takes care of SSL for custom domain?

You’d have to deploy nginx or similar to do the reverse proxy yourself.

3 Likes

That’s correct! We have a guide for nginx. And also a guide for custom domains.

NGINX is a good way to start in your setup. Most people end up moving their app processes over just to keep things simpler, but you can run this kind of setup forever if you’d like.

2 Likes

I’m very new to fly.io. The Nginx guide you linked is not very helpful. I tried

FROM nginx COPY nginx.conf /etc/nginx/conf.d/nginx.conf command and it fails saying FROM: can't read /var/mail/nginx

I’ve docker, python and flyctl installed. Is there any other setup I need to do before executing the command above?

This might help! GitHub - fly-apps/nginx: A fly app nginx config

You’ll need the files from that repository, then you need to change the nginx.conf lines to point it at your backend app URL: nginx/nginx.conf at master · fly-apps/nginx · GitHub

2 Likes

Thanks. I was able to deploy nginx to fly and use it at reverse proxy. Also built integration using Graphql to auto create certs, it works beautifully.

One question though, I’m hardcoding the $origin_url and $origin_host_header in nginx.conf file. Is there a way to get it from env variables?

2 Likes

This might help: docs/nginx at master · docker-library/docs · GitHub

3 Likes