Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

4.3.4. Rewrite Rule Sets and Scaling

Rewrite rule sets let Application Gateway v2 change HTTP request and response headers, and the URL path or query string, as traffic passes through. Each rule combines optional conditions with actions, and the set is associated with a routing rule.

Common uses:

  • Strip or add a security header such as Strict-Transport-Security on the way out.
  • Set X-Forwarded-For style headers so the backend can see the original client.
  • Rewrite a public, friendly path onto whatever internal path the application actually serves.

⚠️ Exam Trap: Rewrite is not redirect. A rewrite happens inside the gateway and the client never learns about it — the browser's address bar does not change. A redirect sends a 301 or 302 back to the client, which then makes a second request to the new location. If the requirement says "the user should see the new URL", that is a redirect. If it says "without changing the URL the user sees", that is a rewrite.

Scaling: v2 can run with a fixed manual instance count or with autoscale, where you set a minimum and maximum and the gateway adds capacity with load. Autoscale is the default choice for variable traffic. A manual count is chosen when throughput is predictable and you want cost to be flat and known.

See how it connects
Alvin Varughese
Written byAlvin Varughese
Founder20 professional certifications