본문 바로가기
개발/ASP.NET

ASP.NET http접속을 https로 리다이렉트 시키기

by ispie 2019. 1. 23.

http로 접속시에 https로 리다이렉트 시키고 싶을 경우, IIS의 설정을 변경하거나 어플의 Web.config을 설정을 변경하는 등 선택지는 여러가지가 존재하지만 이번엔 어플 측에서 설정하는 방법을 알아보았습니다.

web.config

<system.webServer>
  <rewrite>
	<rules>
		<rule name="http to https" stopProcessing="true">
			<match url="(.*)" />
			<conditions>
				<add input="{HTTPS}" pattern="^OFF$" />
			</conditions>
			<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
		</rule>
	</rules>
</rewrite>
</system.webServer>

 

원글 작성일  2016-12-28

댓글