1
votes

I am trying to use Nginx as a reverse proxy for a Vaadin application hosted on Tomcat 7. The config file is as follows:

server {
  listen          80;
  server_name     myApp.foo.bar;
  root            /var/lib/tomcat7/webapps/myApp;

  location / {
        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_pass http://localhost:8080/myApp/;
  }
}

When accessing the Vaadin application I am getting a "Cookies Disabled" warning. However, when I access the application directly on Tomcat port 8080, all works well. I assume that it is something to do with Ngnix not forwarding cookies, however I have not been able to work out a solution. To be honest I am not even sure if Nginx is a good choice (I have used Apache2 in the past) Any help or guidance appreciated.

1
Try to add another header: proxy_set_header Host $host; - Aleksey Deryagin
Perfect - thank you. It worked. Could you add it as an answer so I can acknowledge? - skyman

1 Answers

2
votes

Try to add this header:

proxy_set_header Host $host;