2016年9月22日 | Leave a comment 问题: JSF https 页面 button action return “***?faces-redirect=true” 点按钮跳转后变成了http 使用 mojarra <h:commandButton action="testBean.redirect" value="测试跳转" /> 1 <h:commandButton action="testBean.redirect" value="测试跳转" /> @ManagedBean(name="testBean") @RequestScoped public class TestBean{ public String redirect(){ return "b?faces-redirect=true"; } } 12345678910 @ManagedBean(name="testBean")@RequestScopedpublic class TestBean{ public String redirect(){return "b?faces-redirect=true";} } 跳转到 b 页面后成了http://****/b.jsf 分析: 参考文章发现 是因为 nginx https + tomcat http 时 JSF 认为是http,所以出现这种问题 解决: 配置一个独立的 tomcat http connector 用于https <Connector port="1081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="1443" proxyPort="443" scheme="https" secure="true" /> 123 <Connector port="1081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="1443" proxyPort="443" scheme="https" secure="true" /> proxyPort=443 不能少 参考: http://stackoverflow.com/questions/23018248/jsf-faces-redirect-true-redirects-from-https-to-http-url-due-to-apache-p http://www.oschina.net/question/12_213459 http://tomcat.apache.org/tomcat-8.0-doc/proxy-howto.html