2 years ago
Hello all,
I am using the following https://github.com/toyjack/railway-nginx-basic-auth.
It is working with this template being public, the nextjs is internal. When I redeploy, the website become unavailable:
2024/05/28 16:23:21 [error] 31#31: *1156 upstream timed out (110: Operation timed out) while connecting to upstream, client:
192.168.16.6, server: _, request: "GET /infinity/dashboard/ HTTP/1.1", upstream: "http://[fd12:4c67:9587:0:4000:4:91e8:210f]:3000/infinity/dashboard/", host: "appname.up.railway.app"
Do you know what could be the issue?
Thanks
15 Replies
2 years ago
is nextjs listening on ipv6? if not, it needs to be as the private network is ipv6 only
2 years ago
yep that's fair, I didn't hear back so I marked as solved, my apologies.
the issue here is that nginx is using a caching dns resolver, so when you deploy the other service it gets a new ipv6 ip and thus the ip that nginx has in its cache is incorrect and that's where you are getting the error.
the fix for this is to configure nginx to not cache dns, or the better option would be to switch to caddy instead where no extra configurations are needed to disable dns cache.
If you have a template with caddy and with a username password that will work, I am all in
or if we only need a simple nginx to not cache dns, I will try to find something there first
2 years ago
I'll see if I can whip something up for caddy
2 years ago
hey, sorry it took me longer than id like to get to this, but i have a working drop in replacement now -
simply fork this, then replace your auth services' source with your fork.
this caddy basic auth now also has a /health-check endpoint you can use to set a health check in the service settings
2 years ago
sounds good!