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

Junichi Iseki 21 Reputation points
2022-05-18T04:22:15.037+00:00

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
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
1,083 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. ChaitanyaNaykodi-MSFT 26,366 Reputation points Microsoft Employee
    2022-05-19T03:49:00.757+00:00

    Hello @Junichi Iseki , 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!

    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.