Forum Discussion

Belavrin's avatar
Belavrin
Icon for Nimbostratus rankNimbostratus
Apr 12, 2021

https Redirect with and without folder

Hello experts :)

 

I'm really new to BIG IP and need to make some irules for some hosts. My Problem is that i need some "special" redirects and the one i searched and tested did not work for me.

 

What do i need:

If a User goes to https://example.com it should be redirect to https://example.com/content

If a User goes to https://example.com/pwreset it should be redirect to https://example2.com/xxx

If a user goes to https://example.com/admin it should be redirect to https://example.com/#/login

 

when HTTP_REQUEST {

  if { [HTTP::path] eq "/" } {

    HTTP::redirect "https://example.com/content"

  }

  if { [HTTP::path] eq "/admin" } {

    HTTP::redirect " https://example.com/#/login"

  }

  elseif { [HTTP::uri] eq "/pwreset"} { HTTP::redirect "https://example2.com/xxx"

  }

  }

 

But it looks like that if i go to /admin bigIP redirects to https://example.com/#/login but because of the /#/ the first line maches as well. Sorry if it is a dump question but im not really good at writing code and so.

 

Later i have to check also if teh request for /admin is coming from aninternal or external IP, but thats something i will try after the redirect itself are working.

 

Would be really great if someone could point me in the right direction or help me out :)

 

best regards

Bela

5 Replies