AFD Premium - 301 to a shorter query string

Jack Jin MSFT Accenture 80 Reputation points Microsoft Vendor
2024-05-06T19:43:59.8566667+00:00

Hello!

We're looking to have AFD help us and shorten query strings with a pattern. While query string in "condition" seems to have regex support, we can't seem to access the same capture group in the "action".

Goal:

301 redirect following URL

source: abcd.html?abcd=efg-removerthis-hij&klm=nop

destination: abcd.html?abcd=efg&klm=nop

It's easy to use regex and identify removethis-xxxx, however we'll still need to output ?abcd=efg&klm=nop. This would be possible if we can capture the capture groups 1 and 2, however we're not sure if we can do this with Azure Front Door.

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
622 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ChaitanyaNaykodi-MSFT 24,231 Reputation points Microsoft Employee
    2024-05-07T00:44:43.6633333+00:00

    @Jack Jin MSFT Accenture

    Thank you for reaching out.

    I understand you wish to reconstruct/shorten the query string for example: abcd.html?abcd=efg-removerthis-hij&klm=nop to abcd.html?abcd=efg&klm=nop

    Based on your question above

    This would be possible if we can capture the capture groups 1 and 2, however we're not sure if we can do this with Azure Front Door.

    I do not think in Front door we can capture the groups 1 and 2. As documented here query_string server variable in the request http://contoso.com:8080/article.aspx?id=123&title=fabrikam, the query_string value is id=123&title=fabrikam. So, the individual query parameters will not be captured.

    So, I do not think it will be achievable using Front Door Rules Engine.It will help if you could file feedback regarding this request on the feedback portal

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

    0 comments No comments