Forum Discussion

jcrubaugh's avatar
jcrubaugh
Icon for Nimbostratus rankNimbostratus
Apr 29, 2025

URL Redirect ? URL ReWrite ?

im still on my journey leanring nginx so forgive the stupid question.

my goal is as follows:

 

i want my clients to be able to browse to   https://www.john.com/Greenlight

in the clients browser i dont want the above to change, but i want to get the page load to populate actually from here.   https://dev-assets.john.net/cdn/html2canvas/1.4.1/license.html

i tried this, but its not working.. i think im close..but maybe not..

 

############################################################ Greenlight redirect
        location /Greenlight {
        rewrite ^/Greenlight(/.*)$ $1 break;
        rewrite ^/Greenlight$ / break;

        proxy_pass https://dev-assets.john.net/cdn/html2canvas/1.4.1;
        proxy_set_header Host john-assets.alkami.net;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        try_files $uri $uri/ /license.html;   
        }

 

im thinking maybe i need a re-write statement... any guidance would be apprecited.

1 Reply

  • Hi jcrubaugh​ ,

     

    Have you tried creating LTM policy for such requirement.

    Try to configure URL Redirect and URL Rewrite using policies on F5 LTM.

    To Create a Policy:

    Navigate to Local Traffic > Policies.

    Select the action in the rule as per your requirement

    Based on your selection the option will get changed:

     

    Once done Click Save

    After that you have to PUBLISH this policy before applying to the VIP as this policy will be visible in Draft Policy.

    Select your Policy from the Draft Policies section and click Publish.

     

    Now go to the VIP and Apply it in the Policy Section.

    Here are some basic steps based on the above screenshots:

    Create a Policy:

    Navigate to Local Traffic > Policies.
    Click on Create.
    Enter a name for the policy (e.g., URL_Redirect_Policy).
    Click Create Policy.
    Add a Rule to the Policy:

    Click on Add Rule.
    Enter a name for the rule (e.g., Redirect_Rule).

     

    Configure Conditions:

    Click on Add Condition.
    Select HTTP URI from the drop-down menu.
    Set the Match Type to starts with.
    Enter the old path (e.g., /oldpath).
    Configure Actions:

    Click on Add Action.
    Select Redirect from the drop-down menu.
    Enter the new URL (e.g., http://www.example.com/newpath).
    Save the Rule:

    Click Save.
    Publish policy don't forget, this is very important step as i mentioned above as well.


    And now it is time to Assign the Policy to a Virtual Server

    let me know for any further assistance.

    HTH

    Kindly rate if it helps.