[IIS][GitLab] Reverse Proxy 後的小問題

栏目: ASP.NET · 发布时间: 6年前

内容简介:既上次會產生上面兩點的原因是 IIS 對靜態檔案有預設的保護機制,不會將不認識的副檔名暴露給外部連線下載,其中這個問題是因為 IIS 將網址重複 UrlEncode 兩次,讓藏在後面的 gitlab 無法正確辨識網址。

既上次 [IIS][GitLab] 利用 IIS Reverse Proxy 將 GitLab 加上 Https 將 gitlab 擺到 iis 後面之後,遇到部分功能無法正常使用的問題

  1. 無法瀏覽 .cs.config 等檔案
  2. 無法使用 WebIDE
  3. 無法使用 檔案庫 -> 比較 功能

問題緣由

  • 無法瀏覽 .cs.config 等檔案
  • 無法使用 檔案庫 -> 比較 功能

會產生上面兩點的原因是 IIS 對靜態檔案有預設的保護機制,不會將不認識的副檔名暴露給外部連線下載,其中 .config 更是 ASP.NET 設定檔的副檔名,但這站台只是當作中繼站做轉發的動作而已,所以我判斷可以關閉所有安全機制。

解決方法

  1. 開啟 web.config
  2. 找到 configuration -> system.webServer -> staticContent 結點 (若無則新增)
  3. 新增下列設定
    <mimeMap fileExtension=".*" mimeType="application/octet-stream" />
    <mimeMap fileExtension="." mimeType="application/octet-stream" />
    
  4. 找到  configuration -> system.webServer -> security 結點 (若無則新增)
  5. 新增下列設定
    <requestFiltering>
        <hiddenSegments>
            <clear />
        </hiddenSegments>
        <denyUrlSequences>
            <clear />
        </denyUrlSequences>
        <fileExtensions allowUnlisted="true">
            <clear />
        </fileExtensions>
    </requestFiltering>
    

問題緣由

  • 無法使用 WebIDE

這個問題是因為 IIS 將網址重複 UrlEncode 兩次,讓藏在後面的 gitlab 無法正確辨識網址。

解決方法

  1. 開啟 web.config
  2. 找到  configuration -> system.webServer -> rewrite -> rules 結點
  3. 新增 useOriginalURLEncoding 屬性如下
    <rules useOriginalURLEncoding="false">
        ....
    </rules>
    
  4. 找到 gitlab 反向代理 rule -> action 結點並修改 url 屬性如下
    <action type="Rewrite" url="http://192.168.1.100{UNENCODED_URL}" />
    

參考資料:


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Invisible Users

Invisible Users

Jenna Burrell / The MIT Press / 2012-5-4 / USD 36.00

The urban youth frequenting the Internet cafes of Accra, Ghana, who are decidedly not members of their country's elite, use the Internet largely as a way to orchestrate encounters across distance and ......一起来看看 《Invisible Users》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换