Hi @Nikola Oravec
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
Please go through the following points:
- Unfortunately, Azure Front Door Standard/Premium Rules Engine doesn't support extracting values from request headers using RegEx and using those extracted values in URL rewrite actions.
- The Rules Engine primarily focuses on matching conditions and predefined actions.
- While it supports regular expressions in match conditions, it doesn't provide the capability to capture and manipulate extracted values.
- As you mentioned, you currently need to create separate rules for each language.
- While this can be tedious, it's the most straightforward approach within the limitations of Azure Front Door. For your reference: https://learn.microsoft.com/en-us/azure/frontdoor/standard-premium/how-to-configure-rule-set#configure-rule-set-in-azure-portal
- For more complex scenarios, consider using Azure Functions. You can create a function that receives the request, extracts the language code from the Accept-Language header using RegEx, modifies the request URL accordingly and forwards the request to the origin server. For your reference: https://learn.microsoft.com/en-us/azure/azure-app-configuration/quickstart-azure-functions-csharp?tabs=isolated-process
- You can then configure Azure Front Door to route requests to this Azure Function. For your reference: https://learn.microsoft.com/en-us/samples/azure/azure-quickstart-templates/front-door-standard-premium-function-public/#:~:text=Front%20Door%20profile%2C%20endpoint%2C%20origin%20group%2C%20origin%2C%20and%20route%20to%20direct%20traffic%20to%20the%20Azure%20Functions%20application
- If you have more flexibility in your architecture, you can use a custom domain with a reverse proxy to handle the localization logic.
- The reverse proxy can extract the language code and rewrite the URL before forwarding the request to Azure Front Door.
Kindly let us know if the above helps or you need further assistance on this issue.
Thanks,
Sai.