2017-05-05 18 views
0

我试图这里描述重定向不安全的端口上的流量,以确保端口: https://www.ibm.com/support/knowledgecenter/en/SSD28V_9.0.0/com.ibm.websphere.liberty.autogen.core.doc/ae/rwlp_config_httpProxyRedirect.html配置自由与httpProxyRedirect

相反的两个端口都可用,我什么也看不到在日志中。就好像httpProxyRedirect根本没有被配置。

<?xml version="1.0" encoding="UTF-8"?> 
<server description="CAST Liberty Server"> 
    <!-- Enable features --> 
    <featureManager> 
     <feature>webProfile-7.0</feature> 
    </featureManager> 

    <application id="app" context-root="/" type="war" location="${war.name}"> 
     <classloader apiTypeVisibility="spec, ibm-api, api, third-party" /> 
    </application> 

    <httpProxyRedirect id="defaultHttpProxyRedirect" httpPort="${http.port}" httpsPort="${https.port}" /> 

    <keyStore id="defaultKeyStore" password="pass" /> 
    <httpEndpoint host="*" httpPort="${http.port}" httpsPort="${https.port}" id="defaultHttpEndpoint" /> 

    <applicationMonitor updateTrigger="mbean" /> 
</server> 

回答

0

很可能是因为缺少web.xml中的安全约束。该配置告诉服务器需要通过安全传输访问哪些URL,然后将合格请求从非安全端口重新定向到安全端口。本教程可能有所帮助:https://docs.oracle.com/cd/E19798-01/821-1841/bncbk/index.html

另外,请记住server.xml中的httpProxyRedirect配置用于在应用程序服务器前有代理服务器时重定向。例如,您可以在主“www.ibm.com”主机上安装代理服务器 - 侦听HTTP端口80和HTTPS端口443.但该主机可能会将某些请求路由到其他某个主机上的Liberty应用程序服务器(如“ app1host.internal.ibm.com“)监听不同的端口(即HTTP端口9080和HTTPS端口9443)。在这种情况下,只需在web.xml中使用安全限制就会尝试将Liberty服务器上的客户端请求从9080重定向到9443,而在www.ibm.com主机上 - 这些端口上没有任何内容正在监听。在这种情况下,你应该配置httpProxyRedirect这样的:

<httpProxyRedirect httpPort="80" httpsPort="443" host="www.ibm.com" /> 

通过该配置,客户端的HTTP请求到安全的URL将被重定向到www.ibm.com上的端口443,其中代理服务器将转发请求app1host.internal.ibm.com 9443端口

希望这有助于 安迪