2017-05-12 91 views
0

此處如何將替代設置爲任何地址,以便我可以在AWS Application Load Balancer中使用它。如何將http重定向到JBoss EAP 6.4中的https?

<subsystem xmlns="urn:jboss:domain:web:2.2" default-virtual-server="default-host" native="false"> 
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/> 
<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" enable-lookups="false" secure="true" /> 
<virtual-server name="default-host" enable-welcome-root="true"> 
    <rewrite pattern="^/(.*)$" substitution="https://localhost:443/$1" flags="RL"> 
     <condition test="%{HTTPS}" pattern="off" /> 
    </rewrite>    
    <alias name="localhost"/> 
    <alias name="example.com"/> 
</virtual-server> 

我要像

<rewrite pattern="^/(.*)$" substitution="https://%HOST_NAME%" flags="RL"> 
    <condition test="%{HTTPS}" pattern="off" /> 
</rewrite> 

回答

0

下面是從HTTP重定向到https的EAP 6的步驟,

添加重定向端口= 「443」http連接器如下:

<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" redirect-port="443"/> 

變化如下HTTPS的插座結合到443:在EAP 6

<socket-binding name="https" port="443"/> 

配置HTTPS連接器,

<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true"> 
       <ssl name="ssl" key-alias="mykey" password="password" certificate-key-file="/path/to/keystore.jks"/> 
     </connector> 

編輯應用程序的web.xml如下: -

<web-app> 
     <security-constraint> 
     <web-resource-collection> 
      <web-resource-name>Application</web-resource-name> 
      <url-pattern>/*</url-pattern> 
     </web-resource-collection> 
     <user-data-constraint> 
      <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
     </user-data-constraint> 
    </security-constraint> 

    </web-app> 
+0

它仍然重定向到** http **只,它不工作** https **。已修改** web.xml **還有 –

+0

' <連接器名稱=「https」protocol =「HTTP/1.1」scheme =「https」socket-binding =「https」enable-lookups =「false」secure =「true」> ' –