Websphere 使用httpProxyRedirect配置Liberty
我正在尝试将不安全端口上的流量重定向到安全端口,如下所述: 相反,这两个端口都可用,我在日志中看不到任何内容。就好像根本没有配置httpProxyRedirect一样Websphere 使用httpProxyRedirect配置Liberty,websphere,websphere-liberty,http-redirect,Websphere,Websphere Liberty,Http Redirect,我正在尝试将不安全端口上的流量重定向到安全端口,如下所述: 相反,这两个端口都可用,我在日志中看不到任何内容。就好像根本没有配置httpProxyRedirect一样 <?xml version="1.0" encoding="UTF-8"?> <server description="CAST Liberty Server"> <!-- Enable features --> <featureManager> &
<?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>
webProfile-7.0
很可能您缺少web.xml中的安全约束。此配置告诉服务器需要通过安全传输访问哪些URL,然后将符合条件的请求从非安全端口重新定向到安全端口。本教程可能有助于:
另外,请记住,server.xml中的httpProxyRedirect配置用于在应用程序服务器前面有代理服务器时重定向。例如,您的代理服务器可能位于主“www.ibm.com”主机上—侦听HTTP端口80和HTTPS端口443。但该主机可能会将一些请求路由到其他主机(如“app1host.internal.ibm.com”)上的Liberty应用程序服务器,该主机侦听不同的端口(即HTTP端口9080和HTTPS端口9443)。在这种情况下,仅使用web.xml中的安全约束将尝试将Liberty服务器上的客户机请求从9080重定向到9443,而不是在www.ibm.com主机上,在该主机上,这些端口上没有任何内容正在侦听。在这种情况下,您应该如下配置httpProxyRedirect:
<httpProxyRedirect httpPort="80" httpsPort="443" host="www.ibm.com" />
通过配置,对安全URL的客户端HTTP请求将重定向到端口443上的www.ibm.com,代理服务器将在该端口将请求转发到app1host.internal.ibm.com端口9443
希望这有帮助,
Andy这是我在web.xml中使用的安全约束,它对Tomcat和IBM Websphere 8.5.5.15都很有效:
<security-constraint>
<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
整个应用程序
/*
保密的
注意:请确保将其放在
之后