adamzammit / limesurvey-docker

Production ready dockerised Limesurvey
GNU General Public License v3.0
86 stars 51 forks source link

Cannot access backend with nginx reverse proxy #37

Closed pixelmess closed 8 months ago

pixelmess commented 1 year ago

I am using a pretty basic nginx reverse proxy config for my SSL setup.

Unfortunately the limesurvey admin-backend always redirects to http://limesurvey/admin/ when I am trying to access survey.mydomain.com/admin.

My nginx compose setup:

nginx:
   container_name: limesurvey_proxy
   restart: always
   image: nginx
   volumes:
   - /etc/containers/limesurvey/nginx.conf:/etc/nginx/nginx.conf:ro
   - /etc/containers/limesurvey/limesite.conf:/etc/nginx/conf.d/default.conf:ro
   - /etc/containers/limesurvey/certs:/etc/nginx/certs
   - /opt/limesurvey/nginx-logs:/var/log/nginx
   ports:
   - 443:443
   links:
   - limesurvey
   networks:
     limenetwork_compose:
   command: /bin/bash -c "nginx -g 'daemon off;'"

the relevant nginx config:

server {
    listen       443 ssl http2;
    server_name <FQDN>;

        ssl_certificate     /etc/nginx/certs/crt.pem;
        ssl_certificate_key /etc/nginx/certs/key.pem;

        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_session_cache shared:SSL:10m;
        ssl_session_tickets off;
        ssl_stapling off;
        ssl_stapling_verify off;

    location / {
    proxy_pass http://limesurvey:80/;
    proxy_buffering off;
    proxy_http_version 1.1;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    access_log off;
    client_max_body_size 4096m;
}

The surveys work fine with the reverse proxy and the default start page also loads fine. Only the admin-backend is not working properly.

Is there any way to fix this issue?

adamzammit commented 1 year ago

Apologies I'm not familiar enough with nginx to help you with this.

I can say that I test this using apache as a reverse proxy and don't have this issue.

pixelmess commented 1 year ago

Thanks for the reply.

Could you post your apache config so I can see which parameters might be useful for me? Is there anything special?

are the fixes mentioned here still relevant?

adamzammit commented 1 year ago

Those fixes shouldn't be required anymore.

Here is an example apache reverse proxy configuration. I have tested this on the latest release 5.6.11 along with previous releases. I've stripped out non-necessary elements.

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
        ServerAdmin email@email.email
        ServerName limesurvey.test.url
        DocumentRoot /var/www/limesurvey.test.url

        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Port "443"
        ProxyPreserveHost On
        ProxyRequests off
        ProxyPass /.wellknown !
        ProxyPass / http://127.0.0.1:8080/
        ProxyPassReverse / http://127.0.0.1:8080

</VirtualHost>
</IfModule>

Sorry needed to update multiple times to get the XML showing up correctly