vijaygill / wg-ui-plus

Wireguard VPN + Management Web-UI with fine-grained control over access.
MIT License
2 stars 0 forks source link

Suspect CORS issue #65

Closed thecoshman closed 4 months ago

thecoshman commented 4 months ago

When running the service, I am able to use the web-ui if I am accessing the container directly via the http port, but seems if I use a reverse proxy, nginx in my case, even though I am meant to be logged in, trying to create a new peer results in the logs showing that I am forbidden

Forbidden: /api/v1/data/peer/ 2024-06-12 05:34:59,001 WARNING django.request Forbidden: /api/v1/data/peer/ 2024-06-12 05:34:59,003 WARNING django.server "POST /api/v1/data/peer/ HTTP/1.0" 403 193

The nginx config for this virtual server is the same as what I use for all my other containers without issue, so unless this app requires something special, it believe it's the app that is the issue here.

vijaygill commented 4 months ago

@thecoshman - I am not sure how your reverse-proxy is setup. I have it behind nginx reverse-proxy too and it just works. Have you got the permissions issue on data files sorted? I am running this app in docker too (port 8880 mapped to 8000 because I have another app running on 8000 already) I am using following settings for nginx.

server {
        server_name wg.gillsoft.home wg;
        set $upstream http://gitserver.gillsoft.home:8880;
        resolver 192.168.0.5;
        location / {
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "Upgrade";
          proxy_set_header Host $host;
          proxy_pass $upstream;
        }
    }
thecoshman commented 4 months ago

So we got to the bottom of this, the app wasn't accepting trusted origins, and there was no way to configure this. A new update will soon be published I am promised that will allow you set this in the compose file, so you can set an env variable like CSRF_TRUSTED_ORIGINS=https://wg-ui-plus.example.com and then the Python app is happy being sat behind a reverse proxy.