nginx reverse proxy and setting session id

We are using prodigy and have set up an nginx reverse proxy to access it from the web with user authentication. However, every user that connects is currently annotating in the default session. I have tried many things to get this to work, but my current nginx configuration is below. I can confirm that the rewrite is working; I pointed it at another server and checked that the parameters are being passed. I think it may have something to do with the POST request to get_session_questions, but I'm not http fluent enough to understand completely. Any help or suggestions?

server { 
    listen 81;
#   server_name;
    location / {
            rewrite_log on;
            rewrite ^(.*)$ $1?session=$remote_user break;
            auth_basic  "Username and Password Required";
            auth_basic_user_file  /etc/nginx/.htpasswd;
            proxy_redirect /;
            proxy_read_timeout 60s;
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header session $remote_user;
1 Like

Hi @Strive, welcome!

I always struggle when setting up Nginx configurations, so it's hard to say what's going wrong given your example.

If you can create a simple "hello world" style app using your Nginx configuration that fails, we could run the code and help debug it. I bet there's a Docker+Nginx template you could base your reproduction on.

Depending on your security requirements you could also try using the built-in support for basic auth in front of the UI. Rather than use Nginx you could pass user/pass arguments on the command line when starting the prodigy server:

PRODIGY_BASIC_AUTH_USER="your-awesome-project" PRODIGY_BASIC_AUTH_PASS="your-secret-password" prodigy [your args]