HTTP redirect rule not working
search cancel

HTTP redirect rule not working

book

Article ID: 411357

calendar_today

Updated On:

Products

VMware NSX

Issue/Introduction

  • NSX Load Balancing is in use.
  • A new Request Forwarding rule was created to redirect matching paths to an alternate URL.
  • The new Request Forwarding rule is not redirecting to the correct URL.
  • A custom Application Profile is defined for the Load Balancer.


  • The Application Profile has a Redirection and Redirect Address defined.

Environment

  • VMware NSX 4.x
  • VMware NSX-T Data Center 3.x

Cause

A Load Balancing rule will be pre-empted by a redirection that has been configured in the Load Balancer's Application Profile.

Resolution

The redirection from the Application Profile needs to be moved to a rule.

  1. Edit the Application Profile and change Redirection to "None".

  2. Create the desired load balancer rules.

    If the intent of the new rule is to forward requests for a URL with "test" at the end, create a new rule like the following example:

    Condition: HTTP Request URI Action: HTTP Redirect
    Match Type: Ends with Redirect Status: 302
    URI: test Redirect URL: https://<redirect-url>
    Case Sensitive: Disabled  
    Negate: Disabled  

  3. Add the redirection from the Application Profile as the last rule in the list so it can run as a fallback.

    Condition: HTTP Request URI Action: HTTP Redirect
    Match Type: Matches Regex Redirect Status: 301
    URI: .* Redirect URL: https://<application-profile-redirect-url>
    Case Sensitive: Disabled  
    Negate: Disabled  


    Ensure the fallback rule remains at the bottom of the list of rules when additional rules are added.