skyman
skyman

Reputation: 2335

Vaadin, Tomcat 7 with Nginx as Reverse Proxy

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.

Upvotes: 1

Views: 1926

Answers (1)

Aleksey Deryagin
Aleksey Deryagin

Reputation: 2675

Try to add this header:

proxy_set_header Host $host;

Upvotes: 2

Related Questions