Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on login after connecting to another web app in back-end, NGINX reverse proxy #9390

Closed
Tos26 opened this issue Mar 20, 2024 · 3 comments

Comments

@Tos26
Copy link

Tos26 commented Mar 20, 2024

Hello,

Up to now, I used roundcube, navidrome and calibre-web on a Raspberry PI 3, thru NGNIX as front-end.
I recently added a new service on my server (Home assistant).

Now, when I'm connected to HA, I get this error when I want to access to roundcube: (Sorry, it's in french)
image

So, I have to do that in firefox to be able to connect to Roundcube.
image

And this behavior comes again each time after an access to HA, and only with Roundcube, not with the other services.

Here is my nginx config:

    location /roundcube {
            index index.php;
            try_files $uri $uri/ /index.php?q=$uri&$args;

            location ~ ^/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
                    deny all;
            }
            location ~ ^/(bin|SQL)/ {
                    deny all;
            }
            # A long browser cache lifetime can speed up repeat visits to your page
            location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
                    access_log        off;
                    log_not_found     off;
                    expires           360d;
            }
            location ~ \.php$ {
                    try_files $uri =404;
                    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include fastcgi_params;
            }


    }

    # Reverse Proxy navidrome server
    location /navidrome {
            proxy_pass http://navidrome;
            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 $scheme;
            proxy_set_header X-Forwarded-Protocol $scheme;
            proxy_set_header X-Forwarded-Host $http_host;
            proxy_buffering off;
    }

    # Reverse Proxy calibre-web server
    location /calibre {
            proxy_pass http://calibre-web;
            proxy_bind $server_addr;
            proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Scheme $scheme;
            proxy_set_header X-Script-Name /calibre;
    }

    # Reverse Proxy home-assistant server
    location / {
            proxy_pass http://homeassistant;
            proxy_set_header Host $host;

            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
    }

    location /api/websocket {
            proxy_pass http://homeassistant/api/websocket;
            proxy_set_header Host $host;

            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
    }

You can notice that HA is at URL root and the other services are at URL/SUBFOLDER

My config:

  • Raspberry PI3 B+
  • Roundcube 1.6.5 no docker
  • Firefox 123.0.1

Can anyone help me figure out what's going on and where I'm going wrong with the nginx configuration?

Thank you in advance.

@Tos26 Tos26 changed the title Error on login after connecting to another web server in back-end, NGINX reverse proxy Error on login after connecting to another web app in back-end, NGINX reverse proxy Mar 20, 2024
@Tos26
Copy link
Author

Tos26 commented Apr 2, 2024

Hello,

Additional question: Could websocket be the root cause? Is it an incompatibility between the config for home assistant and Roundcube ?

@alecpl
Copy link
Member

alecpl commented Apr 13, 2024

Roundcube is not using websockets. This is a CSRF protection, I don't see an issue here. Web server configuration is out of scope for this bug tracker. You can try asking on the forum.

@alecpl alecpl closed this as completed Apr 13, 2024
@Tos26
Copy link
Author

Tos26 commented Apr 15, 2024

Ok, understood, thank you for the answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants