nginx not finding flycast

I’m trying to use flycast to try to proxy all my apps into one domain. This is my nginx conf:

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}

http {

    # prevent css, js files sent as text/plain objects
    include /etc/nginx/mime.types;

    server {
        listen 443;
        listen [::]:443;
        client_max_body_size 10M;

        location / {
            proxy_pass https://frontend.fly.dev/;
            proxy_http_version 1.1;
            proxy_set_header X-Forwarded-Host $http_host;
            proxy_ssl_server_name on;
        }

         location /api {
             proxy_set_header X-Forwarded-Host $http_host;
             proxy_pass http://backend.flycast:8000;
         }
      
    }
}

When i run the nginx server I’m getting this error:

nginx: [emerg] host not found in upstream "backend.flycast" in /etc/nginx/nginx.conf:31

Does your backend have the proper ipv6 private address?

I’m not an nginx pro, so please correct me if I’m wrong, but when you use the inline proxy_pass, nginx won’t be able to proxy it if the proxy goes to sleep… at least that’s what I was experiencing before but that make have been a fluke.

You have to use a mapping:

    map $http_host $backend{
        default http://backend.flycast; 
    }
 proxy_pass $backend;

Like @khuezy mentioned,it might be a DNS issue. If you run nslookup or dig to backend.flycast, it should return a private IPv6 address(that matches with your AAAA record).

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.