2017-03-14 54 views
0

你好我試圖建立從http永久重定向(301)到HTTPS在碼頭9.我到處找不到解決的辦法是加在我的web.xml中有以下永久HTTP重定向到https在碼頭9

<security-constraint> 
    <web-resource-collection> 
    <web-resource-name>Everything</web-resource-name> 
    <url-pattern>/*</url-pattern> 
    </web-resource-collection> 
    <user-data-constraint> 
    <transport-guarantee>INTEGRAL</transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 

這設置了302重定向,而不是301重定向,這是一個大問題,任何人都知道我可以如何將其改爲301重定向?

回答

0

我想您在傳輸保證了一個錯誤,所以你必須把這個代替

<security-constraint> 
    <web-resource-collection> 
    <web-resource-name>Everything</web-resource-name> 
    <url-pattern>/*</url-pattern> 
    </web-resource-collection> 
    <user-data-constraint> 
    <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 
<Call name="addConnector"> 
    <Arg> 
     <New class="org.eclipse.jetty.nio.SelectChannelConnector"> 
     ... 
     <Set name="confidentialPort">443</Set> 
     </New> 
    </Arg> 
</Call> 
+0

我沒有犯錯。我在運輸保證中嘗試了CONFIDENTIAL和INTEGRAL,並且據我所知,兩者都導致了完全相同的行爲。 – Vincent

+0

你有沒有添加連接器?如果你不檢查我的答案編輯。 –