我正在为我的项目使用Spring MVC 4.1.6.RELEASE版本。我在登录,注册和忘记密码页面上有不同场景的闪存属性,这些页面在用户登录之前被访问。应用程序在我的localhost上运行完全正常,这是一个带有Wildfly 8.2版本的mac。
问题: 我已经使用RHEL版本7(64位)创建了一个Amazon EC2实例,并使用相同的JDK安装并配置了Wildfly的确切版本。没有闪存属性显示注册和忘记密码方案。但是,同一页面上的任何表单提交错误都显示正常。另一个奇怪的事情是,一旦登录,任何和所有的flash消息都会显示出来。
研究: 这是我发现的最接近的问题,似乎是“//”错误,我已经确定不是这样的: https://bugzilla.redhat.com/show_bug.cgi?id=1072604
非常感谢任何指导!
更新 我的本地和亚马逊设置之间的一个区别是Apache。我在亚马逊ec2上设置了Apache。希望有人可以在我还在茫然的时候抛出一些亮光。
更新2: 更新后我开始研究Apache并发现问题(见下面的链接),这正是我的问题但是我不知道如何解决我的问题。
Spring's flashAttributes don't work behind a reverse proxy
更新3: 经过更多的试验和错误后,我发现如果我使用static-ip访问网站,如http:// xx.xx.xx.xxx:8080/context-root/forgot-password,flash属性工作正常当我使用域名时工作 - http:// www.domainname.com/context-root/forgot-password。
我提供了现有配置。任何mod_proxy专家,请帮忙。
托管: 2 A记录
@ 12.34.56.789 - 这是Amazon EC2的静态IP
www 12.34.56.789 - 这是Amazon EC2的静态IP
Apache配置
/etc/apache/httpd/conf/httpd.conf
<VirtualHost *:80>
ServerName 111.22.33.44 # this is local address of ec2.
ProxyPreserveHost On
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /context-root http://111.22.33.44:8080/<context-root>/
ProxyPassReverse /context-root http://111.22.33.44:8080/<context-root>/
ProxyPass / http://111.22.33.44:8080/<context-root>/
ProxyPassReverse / http://111.22.33.44:8080/<context-root>/
</VirtualHost>
Wildfly配置:standalone.xml
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
<interface name="external">
<nic name="eth0"/>
</interface>
</interfaces>
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="management-http" interface="external" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="external" port="${jboss.management.https.port:9993}"/>
<socket-binding name="ajp" interface="external" port="${jboss.ajp.port:8009}"/>
<socket-binding name="http" interface="external" port="${jboss.http.port:8080}"/>
<socket-binding name="https" interface="external" port="${jboss.https.port:8443}"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
</socket-binding-group>
Brian提出的标题
这些是我使用静态IP时的标题,flash属性在这种情况下有效
Response Headers
Cache-Control no-cache, no-store, max-age=0, must-revalidate
Connection keep-alive
Content-Language en-US
Content-Length 0
Date **removed**
Expires 0
Location http:// 12.34.56.789:8080/context-root/forgot
Pragma no-cache
Server WildFly/8
X-Powered-By Undertow/1
x-content-type-options nosniff
x-frame-options DENY
x-xss-protection 1; mode=block
Request Headers
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Connection keep-alive
Cookie JSESSIONID=pH25lMW0Rg3HKK1iXxVKIl1O.ip-111-22-33-44
Host 12.34.56.789:8080
Referer http:// 12.34.56.789:8080/context-root/forgot
Upgrade-Insecure-Requests 1
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:49.0)
Gecko/20100101 Firefox/49.0
Request Headers from upload stream
Content-Length 92
Content-Type application/x-www-form-urlencoded
这些是我使用域名时的标题,Flash属性不起作用
Response Headers
Cache-Control no-cache, no-store, max-age=0, must-revalidate
Connection Keep-Alive
Content-Language en-US
Content-Length 0
Date **removed**
Expires 0
Keep-Alive timeout=5, max=100
Location http:// www.domain-name/context-root/forgot
Pragma no-cache
Server WildFly/8
X-Powered-By Undertow/1
x-content-type-options nosniff
x-frame-options DENY
x-xss-protection 1; mode=block
Request Headers
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Connection keep-alive
Cookie JSESSIONID=4-DUMB5f1U7eTDcNePYUAy8c.ip-111-22-33-44
Host www.domain-name
Referer http:// www.domain-name/context-root/forgot
Upgrade-Insecure-Requests 1
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:49.0) Gecko/20100101 Firefox/49.0
Request Headers from upload stream
Content-Length 92
Content-Type application/x-www-form-urlencoded