Implement rules, URL rewrite, and URL redirect

3.3 Azure Front Door

📘Microsoft Azure Networking Solutions (AZ-700)


In this section, you must clearly understand how to configure and use rules, URL rewrite, and URL redirect in Azure Front Door.

These features are very important in the AZ-700 exam because they control how user requests are processed before reaching backend servers.


1. Understanding the Rules Engine in Azure Front Door

Azure Front Door includes a Rules Engine.

The Rules Engine allows you to:

  • Inspect incoming HTTP/HTTPS requests
  • Check specific conditions
  • Perform actions based on those conditions

Think of it as:
👉 “If this condition is true → Do this action.”


1.1 Why Rules Are Important

In an IT environment, organizations often need to:

  • Redirect HTTP traffic to HTTPS
  • Modify request headers
  • Route traffic differently based on location
  • Rewrite URLs before sending to backend
  • Block or allow certain requests
  • Apply caching policies

All of this is done using Rules Engine.


2. Components of a Rule

Each rule contains:

1️⃣ Match Conditions (IF part)

This checks:

  • Request URL path
  • Host name
  • HTTP method (GET, POST, etc.)
  • Query string
  • Request header
  • Cookie
  • Client IP address
  • Geo location
  • Protocol (HTTP or HTTPS)

If the condition matches, the action is triggered.


2️⃣ Actions (THEN part)

Actions can:

  • Rewrite URL
  • Redirect URL
  • Modify request headers
  • Modify response headers
  • Change cache behavior
  • Route to different backend

3️⃣ Rule Order

Rules are processed in order (top to bottom).

  • Lower number = processed first
  • If multiple rules match, they execute based on priority

For exam:
You must remember that rule priority matters.


3. URL Rewrite in Azure Front Door

3.1 What is URL Rewrite?

URL rewrite changes the request path before sending it to the backend, without changing what the user sees in the browser.

Important:

  • The user’s browser URL does NOT change.
  • Only backend sees the rewritten path.

3.2 Why Use URL Rewrite?

Common IT scenarios:

  • Backend application expects /app/index.html
  • User requests /
  • You rewrite //app/index.html

Another example:

  • Legacy application expects /v1/api
  • You expose /api publicly
  • You rewrite /api/v1/api

This helps:

  • Maintain clean URLs
  • Support legacy systems
  • Avoid changing backend application

3.3 How URL Rewrite Works

Using Rules Engine:

  1. Define match condition (example: path equals /)
  2. Action: Rewrite URL
  3. Specify:
    • Source pattern
    • Destination path
    • Preserve unmatched path (optional)

3.4 Important Exam Points for URL Rewrite

✔ Does NOT trigger browser redirect
✔ Happens before request reaches backend
✔ User does not see the change
✔ Useful for backend compatibility


4. URL Redirect in Azure Front Door

4.1 What is URL Redirect?

URL redirect tells the browser to go to a different URL.

The browser URL changes.

Example:
User types:

http://example.com

Front Door redirects to:

https://example.com

The browser shows the new URL.


4.2 Types of Redirects

Azure Front Door supports:

301 – Permanent Redirect

  • Resource permanently moved
  • Browsers cache it
  • SEO friendly

302 – Temporary Redirect

  • Temporary change
  • Not cached permanently

307 – Temporary Redirect (preserves HTTP method)

308 – Permanent Redirect (preserves HTTP method)

Exam tip:
Know difference between 301 and 302.


4.3 Common Redirect Scenarios

1️⃣ HTTP to HTTPS Redirection

Very common in production environments.

Condition:

  • Protocol = HTTP
    Action:
  • Redirect to HTTPS
  • Status code = 301

2️⃣ Redirect to New Domain

Example:

  • Old domain: oldapp.contoso.com
  • New domain: app.contoso.com

You configure redirect rule in Front Door.


3️⃣ Redirect Based on Path

Example:

  • /blog/articles

4.4 Important Exam Points for Redirect

✔ Browser URL changes
✔ Client makes a new request
✔ Used for HTTP to HTTPS enforcement
✔ Choose correct status code carefully


5. Differences Between URL Rewrite and URL Redirect

FeatureURL RewriteURL Redirect
Browser URL changes?❌ No✅ Yes
New request from client?❌ No✅ Yes
Happens where?At Front Door before backendAt client browser
Use caseBackend path adjustmentForce HTTPS or change domain

Exam questions often test this difference.


6. Rule Sets in Azure Front Door

In modern Azure Front Door (Standard/Premium):

  • Rules are grouped inside Rule Sets
  • Rule Sets are attached to a Route

Flow:

User Request → Route → Rule Set → Backend

So remember:

👉 Rules are applied at the route level.


7. Combining Rules with Other Features

Rules can work together with:

  • Caching
  • WAF (Web Application Firewall)
  • Custom domains
  • Origin groups
  • HTTPS enforcement

For example:

  • WAF checks security
  • Then rule rewrites URL
  • Then traffic goes to backend

Processing order matters.


8. Configuration Steps (High-Level)

To implement rules in Azure Front Door:

  1. Create Azure Front Door profile
  2. Create Endpoint
  3. Configure Origin group
  4. Create Route
  5. Create Rule Set
  6. Add Rule
  7. Define Match Conditions
  8. Define Actions (Rewrite or Redirect)
  9. Associate Rule Set with Route

You should understand this logical flow for the exam.


9. Scenario-Based Understanding (Exam Focus)

Scenario 1:

Requirement:
All HTTP traffic must be secured.

Solution:
Create redirect rule:

  • Condition: Protocol = HTTP
  • Action: Redirect to HTTPS
  • Status: 301

Scenario 2:

Backend expects /app/home but users access /home.

Solution:
Rewrite rule:

  • Condition: Path starts with /home
  • Action: Rewrite to /app/home

Scenario 3:

Company migrated to new domain permanently.

Solution:
Use 301 redirect.


10. Common Exam Traps

⚠ Confusing rewrite with redirect
⚠ Not understanding rule order
⚠ Using wrong status code
⚠ Forgetting to attach rule set to route
⚠ Assuming rewrite changes browser URL


11. Best Practices

  • Use 301 for permanent changes
  • Use rewrite for backend compatibility
  • Use redirect for client-visible changes
  • Test rule priority carefully
  • Keep rules simple and organized

12. Summary for AZ-700 Exam

You must clearly know:

✔ What Rules Engine does
✔ How match conditions work
✔ Difference between rewrite and redirect
✔ When to use 301 vs 302
✔ Rule processing order
✔ Rules are attached to routes
✔ Rewrite does not change browser URL
✔ Redirect changes browser URL


If you understand:

  • How Front Door evaluates conditions
  • How it performs actions
  • The difference between backend modification and client redirection

Then you are fully prepared for this section of the AZ-700 exam.

Buy Me a Coffee