IIS URL 재작성: @import in section?

IIS URL 재작성: @import in section?

저는 JetBrains TeamCity(포트 81에서 TomCat을 사용함)를 IIS 7 뒤에 배치하려고 합니다.http://www.example.com/teamcity/프록시로 지정됨http://myserver:81/. TeamCity가 요소에서 @import를 출력한다는 점을 제외하고는 대부분 작동했다고 생각합니다 <style>. 이 문제를 처리하기 위해 아웃바운드 규칙을 정의하는 방법을 알 수 없습니다.

이 문제를 처리하기 위해 URL 재작성을 어떻게 얻나요?

아니면 대체 가상 디렉터리에 대해 TeamCity에 가르쳐서 모든 항목에 가 붙도록 할 수 있나요 /teamcity?

아니면 TeamCity를 IIS 7.5에 적용할 수 있는 더 좋은 방법이 있습니까?

답변1

업데이트:다음은 완전히 작동하지 않습니다. 일부 Javascript에 문제가 있고 로그아웃 리디렉션이 손상되었습니다.

옵션:

  1. 를 듣고 있는 Tomcat 설치에서 TeamCity를 호스팅합니다 /teamcity. 그러면 아웃바운드 규칙이 필요하지 않습니다. 드루팔 설치를 위해 이 작업을 수행했습니다.
  2. 대신 리디렉션하세요 teamcity.example.com(가상 디렉터리 없음). 있다이에 대한 예시 단계다른 곳. 이를 위해서는 일부 DNS CNAME과 와일드카드 인증서가 필요합니다(외부 액세스에 HTTPS를 사용하는 경우).

다른 지침은 후손을 위해 여기에 남겨두겠습니다.

를 설정하여 텍스트의 일부를 다시 쓰도록 URL 재작성을 구성할 수 있습니다 filterByTags="None".

이제 다음이 포함됩니다 C:\Inetpub\wwwroot\web.config.

<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <!-- Anything to http://www.example.com/teamcity/ should be
             rewritten to http://teamcity:81/ -->
        <rule name="TeamCity (/teamcity)">
          <match url="^teamcity/(.*)" />
          <serverVariables>
            <!-- URL Rewrite can't deal with Encoding: gzip; turn that off. -->
            <set name="HTTP_ACCEPT_ENCODING" value="" />
          </serverVariables>
          <action type="Rewrite"
                  url="http://teamcity:81/{R:1}" />
        </rule>
      </rules>

이것이 인바운드 규칙입니다. 세 가지 아웃바운드 규칙이 있습니다.

      <outboundRules>

로그인 리디렉션:

        <!-- 302 Redirects (for the login page, e.g.) need to be rewritten. -->
        <rule name="Teamcity (/teamcity) - Redirect" preCondition="IsRedirect">
          <match serverVariable="RESPONSE_LOCATION"
                 pattern="http://[^/]+/(.*)" />
          <action type="Rewrite"
                  value="http://www.example.com/teamcity/{R:1}" />
        </rule>

일반 HTML 재작성:

        <!-- Links in HTML need to be rewritten. -->
        <rule name="TeamCity (/teamcity) - HTML" preCondition="IsHTML">
          <!-- I've ellided the other tag types here; you might want them. -->
          <match filterByTags="A, ..."
                 pattern="^(.*)" />
          <action type="Rewrite"
                  value="http://www.example.com/teamcity/{R:1}" />
        </rule>

@CSS 파일 가져오기:

        <!-- TeamCity uses @import for styles; fix that. -->
        <rule name="TeamCity (/teamcity) - Style" preCondition="IsHTML">
          <match filterByTags="None" pattern="@import &quot;/" />
          <action type="Rewrite" value="@import &quot;/teamcity/" />
        </rule>

그리고 몇 가지 전제 조건은 다음과 같습니다.

        <preConditions>
          <preCondition name="IsRedirect">
            <add input="{RESPONSE_STATUS}" pattern="302" />
          </preCondition>
          <preCondition name="IsHTML">
            <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
          </preCondition>
        </preConditions>
      </outboundRules>

    </rewrite>
  </system.webServer>
</configuration>

작동하는 것 같지만 다른 것을 찾으면 돌아와서 이 답변을 업데이트하겠습니다.

관련 정보