spring security 80 to 443 redirect and requires-channel setting

북마크 추가

1. security-context.xml -> 자신의 spring security context 파일

 

<http></http>부분 사이에 

 

<port-mappings>

    <port-mapping http="80" https="443"/>

</port-mappings>

 

를 넣어줍니다.

 

http = 80 , https = 443 번 포트를 사용한다는 뜻입니다. 8443과 같이 포트를 바꿔서 사용하시는 경우 443을 8443으로 적어주세요

 

<http auto-config="true">

 

<port-mappings>

    <port-mapping http="80" https="443"/>

</port-mappings>

</http> 

 

위 상태에서 이제 url 별로 어떤 프로토콜을 사용할지 정의 해 줍니다.

 

<http auto-config="true">

<intercept-url pattern="/**" requires-channel="http" /> 

<intercept-url pattern="/mypage/*" requires-channel="https" /> 

<port-mappings>

    <port-mapping http="80" https="443"/>

</port-mappings>

</http>

 

전체 호출되는 url은 http로 연결하고 /mypage 로 시작하는 url은 https로 redirect 시키게 됩니다.

 

 

AD
관리자
2017-01-13 17:54
SHARE
댓글