1. URL Rewrite(URL 재작성) 설치

URL 재작성을 사용하기 위해서는 웹 플랫폼 인스톨러를 통해서 URL 재작성 기능을 설치해야 합니다.
다운로드 : 
Web Platform Installer

웹 플랫폼 인스톨러에서 URL 재작성 기능을 검색

URL 재작성 2.0 추가 -> 설치(I) 진행

IIS 관리자에서 웹사이트를 선택 IIS기능 목록에 'URL 재작성' 메뉴가 있으면 설치 성공

 

2. 이용 방법

추가 1. ASP.NET_SessionId 쿠키 SameSite=None; Secure 옵션 지정
추가 2. HTTPS 리다이렉트 rule

<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<system.webServer>
    	  <!--Chrome 80업데이트 Session Cookie SameSite=None; Secure 옵션 이슈로 rewrite-'AddSameSiteCookieHttps' rule 추가 1-->
	      <rewrite> <!--VS2010에서는 잘못된 자식요소로 인식--> 
	        <outboundRules> 
	          <rule name="AddSameSiteCookieHttps" preCondition="Https" enabled="true" stopProcessing="true"> 
	            <match serverVariable="RESPONSE_Set-Cookie" pattern="^(.*)(ASP\.NET_SessionId)(=)(.*)$" /> 
	            <action type="Rewrite" value="{R:0}; SameSite=None; Secure" /> 
	          </rule> 
	          <preConditions> 
	            <preCondition name="Https"> 
	              <add input="{HTTPS}" pattern="^ON$" /> 
	              <add input="{HTTP_USER_AGENT}" pattern="iphone|ipad|ipod" negate="true" /> 
	            </preCondition> 
	          </preConditions> 
	        </outboundRules>
            <!--Session Cookie Secure 옵션 이슈로 'RedirectHTTPtoHTTPS' rule 추가 2-->
	        <rules> 
	          <rule name="RedirectHTTPtoHTTPS" 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>
</configuration>



 

'공부방 > ASP.NET' 카테고리의 다른 글

Convert Image URL to base 64 function  (0) 2020.09.09

+ Recent posts