Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I originally asked this question on SO, but perhaps SF is a better place for traction on this question.

I'm having this problem with GWT when it's behind a reverse proxy. The backend app is deployed within a context - let's call it /context.

The GWT app works fine when I hit it directly:

http://host:8080/context/

I can configure a reverse proxy in front it it. Here's my nginx example:

upstream backend {
    server 127.0.0.1:8080;
}

...

location / {
   proxy_pass        http://backend/context/;
}

But, when I run through the reverse proxy, GWT gets confused, saying:

2009-10-04 14:05:41.140:/:WARN:  Login: ERROR: The serialization policy file '/C7F5ECA5E3C10B453290DE47D3BE0F0E.gwt.rpc' was not found; did you forget to include it in this deployment?
2009-10-04 14:05:41.140:/:WARN:  Login: WARNING: Failed to get the SerializationPolicy 'C7F5ECA5E3C10B453290DE47D3BE0F0E' for module 'https://hostname:444/'; a legacy, 1.3.3 compatible, serialization policy will be used.  You may experience SerializationExceptions as a result.
2009-10-04 14:05:41.292:/:WARN:  StoryService: ERROR: The serialization policy file '/0445C2D48AEF2FB8CB70C4D4A7849D88.gwt.rpc' was not found; did you forget to include it in this deployment?
2009-10-04 14:05:41.292:/:WARN:  StoryService: WARNING: Failed to get the SerializationPolicy '0445C2D48AEF2FB8CB70C4D4A7849D88' for module 'https://hostname:444/'; a legacy, 1.3.3 compatible, serialization policy will be used.  You may experience SerializationExceptions as a result.

In other words, GWT isn't getting the word that it needs to prepend /context/ then look for C7F5ECA5E3C10B453290DE47D3BE0F0E.gwt.rpc, but only when the request comes throught proxy. A workaround is to add the context to the url for the web site:

location /context/ {
    proxy_pass        http://backend/context/;
}

but that means the context is now part of the url that the user sees, and that's ugly.

Anybody know how to make GWT happy in this case?

Software versions:
GWT - 1.7.0 (same problem with 1.7.1)
Jetty - 6.1.21 (but the same problem existed under tomcat)
nginx - 0.7.62 (same problem under apache 2.x)

My suspicion is that perhaps GWT is picking up on the Referer header, and getting confused (is there a way for nginx to turn off that header?) or that there's a difference since the traffic between the proxy and GWT/Jetty is HTTP/1.0 instead of HTTP/1.1.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

I think you should

location /context/ {
    proxy_pass        http://backend/context/;
}

and then use rewrite to strip /context part from URL

share|improve this answer
    
It took me a while to figure this out, but it finally dawned on me that my problem was that I was doing the rewrite in the location context, and it needed to be in the server context: rewrite ^/(.*)$ /stuff/$1; location /stuff/ { proxy_pass backend/stuff; } –  Don Branson Oct 16 '09 at 13:59
    
Scratch that - it didn't fix the problem. Maybe it really is a GWT bug. –  Don Branson Oct 16 '09 at 14:20
    
i think nginx has some different behavior depending on closing slashes in proxy_pass directive, so you can play with it –  SaveTheRbtz Oct 18 '09 at 15:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.