duracellko / planningpoker4azure

Planning Poker 4 Azure
MIT License
62 stars 26 forks source link

404 for most of the files in newer version (docker + nginx proxy) #100

Closed ohaz closed 2 years ago

ohaz commented 2 years ago

Hi, I'm having an issue.

I've been running duracellko/planningpoker:b1646 for a long while and it worked like a charm. Recently I tried to update to a newer version and I get the same result everytime. My setup is: nginx proxy (for https and subdomains) -> docker (with -p 12345:8080) -> planningpoker When connecting to the app directly via HTTP and port 12345, everything works like a charm. When connecting to the nginx proxy via https, the issue appears: The first few files load perfectly (with http status code 200). Around when it starts trying to load the .dll files, all files return 404.

Just for good measure, this is my nginx config:

server {​​​​​​​
        listen 443 ssl;
        listen [::]:443 ssl;
        server_name my.example.com;
        location / {​​​​​​​
                proxy_pass http://127.0.0.1:12345;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto https;
                proxy_redirect    off;
        }​​​​​​​
...certificates...
}

Is there anything I can do to fix this?

duracellko commented 2 years ago

Hi, thank you for your feedback. I am bit busy at the moment. I will have a look on weekend.

What I changed recently in Docker image that the app does not run as root anymore. I am not sure if that could have an impact.

duracellko commented 2 years ago

I did following experiment in Ubuntu 20.04 in Windows Subsystem for Linux.

I created file nginx.conf

events {
}

http {
    server {
        listen 443 ssl;
        listen [::]:443 ssl;
        listen 80;
        listen [::]:80;
        # server_name myplanningpoker;
        ssl_certificate planningpoker.crt;
        ssl_certificate_key planningpoker.key;
        location / {
            proxy_pass http://my-planningpoker:8080;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto http;
            proxy_redirect off;
        }
    }
}

and file runproxy.sh

# Create SSL certificate for localhost
openssl genpkey -out planningpoker.key -algorithm RSA -pkeyopt rsa_keygen_bits:2048 &&
openssl req -new -key planningpoker.key -subj /CN=localhost -out planningpoker.csr &&
openssl x509 -req -in planningpoker.csr -signkey planningpoker.key -out planningpoker.crt -days 365 &&
rm planningpoker.csr

# Run planningpoker with nginx
docker network create my-planningpoker-net
docker run --name my-planningpoker -d --network my-planningpoker-net --rm duracellko/planningpoker:b1799
docker run --name my-pp-proxy -d --network my-planningpoker-net -p 8080:443 -v $PWD/nginx.conf:/etc/nginx/nginx.conf:ro -v $PWD/planningpoker.crt:/etc/nginx/planningpoker.crt:ro -v $PWD/planningpoker.key:/etc/nginx/planningpoker.key:ro --rm nginx

enable execution of the shell script chmod u+x runproxy.sh and executed the script. The script started 2 containers: nginx and planningpoker.

I could open the application at https://localhost:8080. I just had to enable certificate trust.

duracellko commented 2 years ago

@ohaz Is this example somehow different from your case?

ohaz commented 2 years ago

localhost:8080 is the port of the planningpoker docker container, not the nginx docker container. Does it work when accessing https://localhost:443?

duracellko commented 2 years ago

In my example I didn't expose any port of planningpoker. No -p argument. I changed exposed port of nginx proxy to 8081. I also checked logs and I could see that connection goes through nginx.

I cannot setup port 443, because I installed Docker in user mode.

ohaz commented 2 years ago

Did you change the https/ssl port of nginx to 8081? Because that's the port that leads to problems on my end

duracellko commented 2 years ago

Nginx is still configured to use port 443

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    ...
}

But container is configured to map it to port 8081 docker run -p 8081:443 ... nginx

ohaz commented 2 years ago

Okay I tried again and the issue just vanished. I have no clue why or how but it's working like a charm now.