反向代理背后的 GWT 问题 - nginx 或 apache [英] Problem with GWT behind a reverse proxy - either nginx or apache

查看:40
本文介绍了反向代理背后的 GWT 问题 - nginx 或 apache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当 GWT 位于反向代理之后时,我遇到了这个问题.后端应用程序部署在上下文中 - 我们称之为/context.

当我直接点击 GWT 应用程序时它运行良好:

http://host:8080/context/

我可以在它前面配置一个反向代理.这是我的 nginx 示例:

<前>上游后端{服务器 127.0.0.1:8080;}...地点/{proxy_pass http://backend/context/;}

但是,当我运行反向代理时,GWT 感到困惑,说:

<前>2009-10-04 14:05:41.140::WARN:登录:错误:未找到序列化策略文件/C7F5ECA5E3C10B453290DE47D3BE0F0E.gwt.rpc";您是否忘记将其包含在此部署中?2009-10-04 14:05:41.140::WARN:登录:警告:无法获取模块https://hostname:444/"的序列化策略C7F5ECA5E3C10B453290DE47D3BE0F0E";将使用旧的、1.3.3 兼容的序列化策略.因此,您可能会遇到 SerializationExceptions.2009-10-04 14:05:41.292::WARN:StoryService:错误:未找到序列化策略文件/0445C2D48AEF2FB8CB70C4D4A7849D88.gwt.rpc";您是否忘记将其包含在此部署中?2009-10-04 14:05:41.292::WARN:StoryService:警告:无法获得模块https://hostname:444/"的序列化策略0445C2D48AEF2FB8CB70C4D4A7849D88";将使用旧的、1.3.3 兼容的序列化策略.因此,您可能会遇到 SerializationExceptions.

换句话说,GWT 并没有得到它需要在/context/前加上 C7F5ECA5E3C10B453290DE47D3BE0F0E.gwt.rpc 的词,但只有当请求来自代理时.一种解决方法是将上下文添加到网站的 url 中:

<前>位置/上下文/{proxy_pass http://backend/context/;}

但这意味着上下文现在是用户看到的 url 的一部分,这很丑陋.

有人知道在这种情况下如何让 GWT 开心吗?

软件版本:
GWT - 1.7.0(与 1.7.1 相同的问题)
Jetty - 6.1.21(但在tomcat下也存在同样的问题)
nginx - 0.7.62(apache 2.x 下同样的问题)

我已经使用 DonsProxy 查看了代理和后端之间的流量,但没有什么值得注意的.

解决方案

我相当确定这里的正确答案是修补源代码并提交错误报告.另一种选择是在后端的 / 处运行 GWT 应用.

我更喜欢前者,但后者也应该可行.如果您真的需要将事情分成多个上下文,请使用不同的端口号?

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/ hen 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)

I've looked at the traffic between the proxy and the backend using DonsProxy, but there's nothing noteworthy there.

解决方案

I'm fairly sure the correct answer here is to patch the source and submit a bug report. Another option would be to run the GWT app at / on your backend.

I'd prefer the former, but the latter should work too. If you really needed things separated out into multiple contexts, use a different port number?

这篇关于反向代理背后的 GWT 问题 - nginx 或 apache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆