0

I have an ASP.NET application running in a docker container that's being server by an NGINX reverse-proxy also in a docker container.

I'm not experienced at all with NGINX or hosting, so please apologize my ignorance. It took me a while to make it work, but everything is working fine besides the images.

I checked the <img> tags inspecting the browser and the src attribute is being filled with upstream-name/images/logo.png instead of my-domain.com/images/logo.png. These images are being built in runtime since they're store in a database as binaries so I assume there isn't a folder that I am supposed to map in my containers (it was working fine without NGINX).

Is anyone able to help?

This is my nginx.conf file:

worker_processes 1;

events { worker_connections 1024; }

http {

    sendfile on;

    upstream webapp{
        server container;
    }

    server {
        listen [::]:80;
        listen 80;
        server_name my-domain.com;
        return 301 https://$host$request_uri;
    }

    server {
        listen [::]:443 ssl http2;
        listen 443 ssl http2;
        server_name my-domain.com; 
    
    ssl_certificate         /ssl/cert.pem;
        ssl_certificate_key     /ssl/key.pem;
 
        location / {
            
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Proto https;
            proxy_pass       http://webapp/;
       }
    }
}
mmgyyc
  • 1
  • 1

1 Answers1

0

I was missing proxy_set_header Host {hostname};

mmgyyc
  • 1
  • 1