question

03771941 avatar image
0 Votes"
03771941 asked ChaitanyaNaykodiMSFT-9638 answered

ApplicationGatewayによるURL書き換え(URL rewriting by ApplicationGateway)

ApplicationGatewayの書き換え機能で応答ヘッダーのLocationを変更しようと考えています。
例えば応答URLを下記のように変更し、表示されるページは「https://olddomain.com/articles/01 」にしたいです。

要求URL:https://olddomain.jp/articles/01
応答URL:https://newdomain.jp/articles/01

正規表現を使ってIF条件を設定していますが、上手く動作していないようです。
記述方法が誤っていますか?
書き換え機能によって上記要件の実現は可能ですか?

If
(https?):\/\/.olddomain.jp\/articles(.)$
Do
{http_resp_Location_1}://newdomain.jp/articles{http_resp_Location_2}
202968-image.png
202980-image.png

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
I am thinking of using the ApplicationGateway rewrite function to change the Location of the response header.
For example, I would like to change the response URL as follows, and the page to be displayed is "https://olddomain.com/articles/01".

Request URL: https://olddomain.jp/articles/01
Response URL: https://newdomain.jp/articles/01

I have set the IF condition using regular expressions, but it doesn't seem to work well.
Is the description method incorrect?
Is it possible to achieve the above requirement by the rewriting function?

Translated with www.DeepL.com/Translator (free version)

azure-application-gateway
image.png (49.7 KiB)
image.png (51.3 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ChaitanyaNaykodiMSFT-9638 avatar image
0 Votes"
ChaitanyaNaykodiMSFT-9638 answered

Hello @03771941, Thank you for reaching out!

As per my understanding from the question, you are trying to rewriting the location header something similar to this tutorial, where you are facing issue while trying to match the regular expression pattern for this URL https://olddomain.jp/articles/01 and currently you are using this pattern (https?):\/\/.olddomain.jp\/articles(.)$ .

So if my understanding above is correct, I think the issue here is due to the extra . and $ symbols in the expression. You can try using this expression (https?):\/\/olddomain.jp\/articles(.) instead and see if helps resolve the issue. I tried it on the regex1091.com and this expression matched.

203542-image.png

Hope this helps! Please let me know if you have any additional questions. Thank you!



image.png (43.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.