2012-12-10 117 views
1

我擁有Spring SEcurity的基本配置。註銷按鈕在HTTP上工作良好,但在處理HTTPS時出現問題。我的安全配置是這樣的:通過https不能正常工作的春季安全註銷

<http use-expressions="true" auto-config="false" entry-point-ref="http403EntryPoint" 
     access-denied-page="/accessDenied"> 
    <intercept-url pattern="/**" access="hasRole('AA_ACCESS')" requires-channel="any"/> 
    <custom-filter position="PRE_AUTH_FILTER" ref="siteminderFilter"/> 
    <session-management> 
     <concurrency-control max-sessions="1" expired-url="/sessionExpired"/> 
    </session-management> 
    <logout invalidate-session="true" delete-cookies="JSESSIONID"/> 
</http> 

註銷按鈕:

<a href="<c:url value="${requestScope.pageContext.servletContext.contextPath}/j_spring_security_logout" />">Logout</a> 

正如我所說的,一切工作正常通過HTTP,而不是HTTPS。

我收到錯誤404頁面未找到。該應用程序運行的端口是:11501爲JBoss AS,而HTTPS是Apache與ajp連接器到JBoss,apache是​​16000,ajp 8009.

+1

這不可能是一個Spring Security的問題。更可能與代理/重定向等有關。請檢查調試日誌並提供更多信息。什麼是導致404的確切請求?它是如何出現在JBoss/tomcat訪問日誌中的? –

+0

失敗的請求是註銷。在按下注銷按鈕後,通過HTTP我的cookie被清理,而通過HTTPS我有404錯誤。在檢查Apache和JBoss日誌之後,我發現通過HTTPS,註銷url後添加了一個斜槓,所以url看起來像這樣:'webcontext // j_spring_security_logout'是它的原因嗎?爲什麼添加這個斜槓? – kamil

回答

1

盧克泰勒是對的。這不是Spring Secuiry問題。記住孩子,在你的同事之後再檢查一次。就我而言,Apache的虛擬主機是配置錯誤:

<VirtualHost *:11600> 
    ServerName localhost 
    DocumentRoot "/apache/htdocs/aa" 
    SSLEngine on 
    SSLCertificateFile "/apache/conf/server.crt" 
    SSLCertificateKeyFile "/apache/conf/server.key" 
    ProxyPass /admin ajp://localhost:8009/admin/ <--- HERE 
    <Directory "/apache/htdocs/aa"> 
     DirectoryIndex index.html 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 
    ErrorLog "logs/error_log" 
    CustomLog "logs/access_log" common 
    LogLevel debug 
</VirtualHost> 

通知額外斜槓的ProxyPass結束,這是問題