Slide 1

Slide 1 text

「/」がウザい Jun Kudo

Slide 2

Slide 2 text

https://slash1.azurewebsites.net/folder/ と https://slash1.azurewebsites.net/folder は違う Web Apps

Slide 3

Slide 3 text

# curl -I https://slash1.azurewebsites.net/folder HTTP/1.1 301 Moved Permanently Content-Length: 163 Content-Type: text/html; charset=UTF-8 Location: https://slash1.azurewebsites.net/folder/ Server: Microsoft-IIS/10.0 X-Powered-By: ASP.NET # curl -I https://slash1.azurewebsites.net/folder/ HTTP/1.1 200 OK Content-Length: 0 Content-Type: text/html Accept-Ranges: bytes ETag: W/"8c40f6f16ab0d71:0" Server: Microsoft-IIS/10.0 X-Powered-By: ASP.NET 一部省略 一部省略

Slide 4

Slide 4 text

https://slash1.azurewebsites.net/folder/ (Trailing Slash) Web Apps はURL末の「/」がないとリダイレクトされる (Windowsのみ)

Slide 5

Slide 5 text

まぁ Web Apps を単体で 利用する場合には特に問題ない気がする

Slide 6

Slide 6 text

「何も表示されません!?」

Slide 7

Slide 7 text

バックエンドプール slash1.azurewebsites.net ドメイン www.server01.pw Application Gateway

Slide 8

Slide 8 text

②バックエンドプール https://slash1.azurewebsites.net/folder ③応答ヘッダー:Location https://slash1.azurewebsites.net/folder/ ①アクセス https://www.server01.pw/folder ④アクセス https://slash1.azurewebsites.net/folder/ アクセス制限 (AppGWのみ許可) ① ② ③ ④

Slide 9

Slide 9 text

# curl -I https://www.server01.pw/folder HTTP/1.1 301 Moved Permanently Content-Type: text/html; charset=UTF-8 Content-Length: 167 Connection: keep-alive Location: https://slash1.azurewebsites.net:443/folder/ Server: Microsoft-IIS/10.0 X-Powered-By: ASP.NET 一部省略

Slide 10

Slide 10 text

対策例 リダイレクト URL を変更する (Locationヘッダーの書き換え) https://docs.microsoft.com/ja-jp/azure/application-gateway/rewrite-http-headers-url#modify-a-redirection-url

Slide 11

Slide 11 text

②バックエンドプール https://slash1.azurewebsites.net/folder ③応答ヘッダー:Location https://slash1.azurewebsites.net/folder/ ①アクセス https://www.server01.pw/folder ⑤アクセス https://www.server01.pw/folder/ ⑥バックエンドプール https://slash1.azurewebsites.net/folder/ ④応答ヘッダー:Locationを書き換え https://www.server01.pw/folder/ ④ ③ ① ② ⑤ ⑥

Slide 12

Slide 12 text

# curl -I https://www.server01.pw/folder HTTP/1.1 301 Moved Permanently Content-Type: text/html; charset=UTF-8 Content-Length: 167 Connection: keep-alive Location: https://www.server01.pw:443/folder/ Server: Microsoft-IIS/10.0 X-Powered-By: ASP.NET 一部省略

Slide 13

Slide 13 text

Application Gatewayの書き換えセットの作成 ヘッダー値: {http_resp_Location_1}://www.server01.pw{http_resp_Location_2} ④応答ヘッダー:Locationを書き換え https://www.server01.pw/folder/ ③応答ヘッダー:Location https://slash1.azurewebsites.net/folder/

Slide 14

Slide 14 text

「/」と仲良くしよう

Slide 15

Slide 15 text

私は、 工藤淳 Microsoft MVP for Azure Iret, inc. / cloudpack @jkudo です。