close

實作環境 windows server 2012 R2 + IIS 8.5

憑證依之前的文章 apache reverse proxy with ssl設定 介紹的方式取得.

但這邊的憑證是.crt 非.pfx

這時就需要轉換

紹介一個線上轉換網站,依照畫面選擇即可.

線上憑證轉換畫面

或者將檔案傳到有openssl的主機,執行以下命令

openssl pkcs12 -export -out certificate.pfx -inkey private.key -in certificate.crt -certfile ca_bundle.crt

也可以得到certificate.pfx憑證檔.

 

IIS匯入憑證

依照下面的圖示作即可匯入憑證並繫結網站

 

IIS SSL 1.png

 

IIS SSL 2.png

 

IIS SSL 3.png

 

既然都已經申請SSL,很有可能僅打算使用https的加密傳輸.

Http to Https轉導

這實需要Url Rewrite Module來達成轉導功能,

使用Web platform Installer來安裝,

Url Rewrite安裝.png

 

此刻在開啟IIS選擇網站後,

可以在IIS Section的功能內見到URL Rewrite,

接著依照 IIS URL Rewrite – 如何建立 HTTP 轉 HTTPS 及 Reverse Proxy  (這網站圖片很詳細,就不多寫了)

我在Rewrite URL :  是根目錄就轉導

https://{HTTP_HOST}/{R:1}

以上就是整個憑證申請到設定轉導的部分.

 

補充,

如果有http post method redirect的需求,

依照上面設定會在redirect時改為get method.

進而可能出錯, 需修改Url Rewrite規則的"動作"部分, 重新導向URL : https://{HTTP_HOST}/{R:1}  重新導向類型 : 暫時(307)

IIS redirect post.png

 

參考

HTTP Redirection in IIS 7 on Windows Server 2008

IIS Url Rewrite and HTTP POST data

 

arrow
arrow
    文章標籤
    iis redrect
    全站熱搜

    abcg5 發表在 痞客邦 留言(0) 人氣()