Web page stuck on session expired

Hello,

I’m having a problem in my web app, when I enter the login page it gives me an error saying that I need to enable cookies in my browser, so I checked the browser and the cookies were enabled. So I tried using a different browser in case there’s something wrong, but the error was the same. When I click on the error (Cookies disabled) another error pops up saying that the session timed-out. Every time I click on the session timeout error, another one pops up. So It’s like the web app is now stuck, I can’t login but the rest service is running perfectly.

Regards,
Julien Saab.

1 Like

Hi,

Could you share your deployment settings? Do you use Nginx behind the app or other web proxy software?

Hello,
We’ve discovered the cause behind this issue.
The HTTP connector in tomcat’s server.xml had the attribute secure = true, but not SSL/TLS connection was established. So all sessions and cookies were being rejected.

I have the same isse but only when I use nginx as proxy server, my config is:


server {  
    server_name spica.gsdata.ro; 
    listen 8080; 
    location /  { 
        proxy_pass http://192.168.5.202:8080/app/; 
        proxy_set_header X-Forwarded-Host $host; 
        proxy_set_header X-Forwarded-Server $host; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_read_timeout     3600; 
        proxy_connect_timeout  240; 
        proxy_set_header Host $host; 
        proxy_set_header X-RealIP $remote_addr; 
        proxy_set_header X-Forwarded-Proto $scheme; 
        proxy_http_version 1.1; 
        proxy_set_header Upgrade $http_upgrade; 
        proxy_set_header Connection "upgrade"; 
    } 
} 

the domain is not real, I have it registered in etc\hosts
127.0.0.1 spica.gsdata.ro
nginx is running on a different server than cuba

Hello George,

try to add proxy cookie path definition into your config:

location / {
    client_max_body_size 5m;
    proxy_pass http://192.168.5.202:8080/app/;
    proxy_cookie_path /app/ /;
    proxy_set_header Cookie $http_cookie;
}
1 Like

Thank you Ivan for your response
I have tried your suggestion but I can’t make it work.
My conf file is like this

http {
		server { 
		server_name petcu.gsdata.ro;
		listen 8080;

		location / 
			{
			 client_max_body_size 5m;
			 proxy_pass [url=http://192.168.5.202:8080/app/]http://192.168.5.202:8080/app/[/url]; 
			 proxy_cookie_path /app/ /;
			 proxy_set_header Cookie $http_cookie;
			 
        proxy_set_header X-Forwarded-Host $host; 
        proxy_set_header X-Forwarded-Server $host; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_read_timeout     3600; 
        proxy_connect_timeout  240; 
        proxy_set_header Host $host; 
        proxy_set_header X-RealIP $remote_addr; 
        proxy_set_header X-Forwarded-Proto $scheme; 
        proxy_http_version 1.1; 
        proxy_set_header Upgrade $http_upgrade; 
        proxy_set_header Connection "upgrade"; 
			}
		}		
}

the application is online at http://petcu.gsdata.ro:8080
Any suggestion is welcomed
thank you

The problem of session expiration may be caused by incorrect proxy_pass/ proxy_cookie_path/ proxy_redirect settings. Possible solution with an example described here.

Hi this is worked for me when I want to acces cuba through root using Nginx
Thank you Ivan !

server {
    listen 80;
    server_name  www.exemple.com;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $remote_addr;
    location /app {
    proxy_pass "http://192.168.1.123:8080/app";
    }
    location / {
    proxy_pass "http://192.168.1.123:8080/app/";
    proxy_cookie_path /app/ /;
    proxy_set_header Cookie $http_cookie;
    }
}
1 Like