Server/Windows Server
IIS Reverse Proxy HTTP 502 Gateway - SVN(Subversion)
달빛에취하다
2023. 2. 15. 17:41
* IIS에서 Visual SVN Server로 Reverse Proxy 설정시 특정 HTTP 동사(COPY, MOVE)에서 HTTP 502 Gateway 관련 내용 발생
* HTTP_DESTINATION 서버 변수 등록 및 사용 관련 내용 참조
* 샘플용 web.config (인바운드만 참조)
* 외부 접속 주소 (샘플) : svn.test.com
* 내부 Visual SVN Server 접속 주소 : 127.0.0.1:8080
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
<match filterByTags="A, Form, Img" pattern="http://127.0.0.1:8080/(.*)" />
<action type="Rewrite" value="https://svn.test.com/{R:1}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
<rules>
<rule name="To https" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" />
</rule>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_DESTINATION}" pattern="https://(.*)" />
</conditions>
<serverVariables>
<set name="HTTP_DESTINATION" value="http://{C:1}" />
</serverVariables>
<action type="Rewrite" url="http://127.0.0.1:8080/{R:1}" />
</rule>
<rule name="ProxyRest" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(.*)" negate="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="http://127.0.0.1:8080/{R:1}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
<urlCompression doStaticCompression="false" doDynamicCompression="false" />
<security>
<requestFiltering allowDoubleEscaping="true">
<requestLimits maxAllowedContentLength="2147483648" maxUrl="2147483648" maxQueryString="2147483648" />
<fileExtensions allowUnlisted="true" applyToWebDAV="true">
<clear />
</fileExtensions>
<verbs allowUnlisted="true" applyToWebDAV="true">
<clear />
</verbs>
<hiddenSegments applyToWebDAV="true">
<clear />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
</configuration>