我使用 flex 3.0 在我的应用程序中开发了仪表板。为此,我在 flex 应用程序周围使用了 JSP 包装器。我的应用程序在 JBoss 应用程序服务器上运行。对于 flex 应用程序和我的应用程序之间的通信,我正在使用 LCDS。 HTTPService 组件用于从服务器接收数据。 amf 和 http channel 以及安全模式和非安全模式的 channel 定义在 service-config.xml 中给出。在我的 proxy-config.xml 中,我定义了 channel 和目的地。
services-config.xml
...
...
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>
<channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>
<channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
</channel-definition>
<channel-definition id="my-secure-http" class="mx.messaging.channels.SecureHTTPChannel">
<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>
...
...
proxy-config.xml
...
...
<default-channels>
<channel ref="my-http"/>
<channel ref="my-amf"/>
<channel ref="my-secure-http"/>
<channel ref="my-secure-amf"/>
</default-channels>
...
...
<destination id="dashboardService">
<properties>
<url>/kr/servlet/DashboardServlet</url>
</properties>
</destination>
<destination id="dashboardJSPService">
<properties>
<url>/kr/krportal/dashboardJSPService.jsf</url>
</properties>
</destination>
...
...
在我的开发环境中,安全模式和非安全模式都运行良好。现在,当我将它部署在负载均衡器后面时(它只接受安全请求,如果请求不安全,它会将其重定向到安全 url),消息代理 servlet 没有响应。我观察到的另一件事是,当环境负载不平衡时,会出现类似 'http://{server.name}:{server.port}/{context.root}/messagebroker/http' 的请求。
并且这些请求是 post 请求。但是在使用 ssl 的负载平衡环境中,请求再次像 'http://{server.name}:{server.port}/{context.root}/messagebroker/http'
这是一个帖子请求并将其重定向到 'https://{server.name}:{server.port}/{context.root}/messagebroker/http'
,这是一个获取请求。本次get请求返回的内容为null。
征求意见
谢谢
最佳答案
这个配置文件被 flex 和 lcds 使用。 Flex 使用它向特定端点发送消息,lcds 使用此文件实际创建端点。您会注意到 URL 末尾的/amf、/amfsecure、/http 和/httpsecure。如果您的负载均衡器正在重定向类似 http://domain.com/app/messagebroker/amf 的调用至 https://domain.com/app/messagebroker/amf它会失败,因为 ssl 端点以/amfsecure 结尾。
关于java - 使用 SSL 在负载平衡环境中设置 flex 应用程序的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35312263/