AZ-700 Question 208
Single answerYou have configured a rewrite rule in Azure Application Gateway to add a custom request header (X-Custom-Header) for requests targeting the /api/orders path. The rule is correctly defined with a condition to match requests whose URL path begins with /api/orders, and you have provided a consistent header name and value. After saving the rule, you find that the header is still missing in requests sent to the backend. What must you do to ensure the rewrite rule is properly applied to inbound requests for /api/orders?
- A
Enable the custom header rewrite in the Application Gateway diagnostic logs
- B
Associate the rewrite set containing the rule with the listener or routing rule that handles /api/orders
- C
Create a Web Application Firewall (WAF) policy referencing the rule
- D
Use path-based rules to forward to a separate back-end pool instead of using rewrite sets
Show answer and explanation
Correct answer: B
Explanation
In Azure Application Gateway, creating a rewrite rule alone is not enough. You must associate the rewrite set (which contains your rule) with the path-based or basic routing rule (or the listener) through the 'Rules' configuration. This ensures that when traffic matching the specified path (/api/orders) arrives, the Application Gateway applies the rewrite before forwarding the request to the backend. For more details, refer to Microsoft documentation on configuring rewrite rules for Application Gateway (https://learn.microsoft.com/azure/application-gateway/rewrite-http-headers).
- A. Incorrect.
Incorrect. Enabling diagnostic logs helps troubleshoot Application Gateway issues but does not enable or activate a rewrite rule. Diagnostic logs do not control rewrite rules.
- B. Correct.
Correct. After defining a rewrite rule, you must explicitly associate the rewrite set with the relevant listener or routing rule for the rule to take effect on traffic. Without this association, the Application Gateway will not apply the rewrite actions to inbound requests.
- C. Incorrect.
Incorrect. A WAF policy is used to enforce security rules, such as blocking malicious requests. It does not activate or manage custom rewrite rules in Application Gateway.
- D. Incorrect.
Incorrect. While path-based rules are used to direct traffic to different back-end pools depending on the request path, they do not handle rewriting headers. You still need to associate the rewrite rule with the listener or routing rule for it to take effect.