Forum Discussion
Incorporating a header rewrite for security purposes
Hi All,
I have been able to make the i-rule work for the purpose it is intended for. However, there is one more thing I have not been able to get to work.
when HTTP_REQUEST { set req [string tolower [HTTP::uri]] if { $req starts_with "/lodi"
} {HTTP::redirect "https://TESTSERVER:8080/lodi/home"} use pool Test_Svrtier_Pool if { $req starts_with "/walking"} { HTTP::redirect "http://TESTSERVER2:8080/BOB/CAT" } }Question: I am trying to incorporate in the above stated irule such that, if a user access an url http://x.x.x.x/lodi , the user is redirected to the site "http://TESTSERVER:8080/lodi/home", this work perfectly fine now with no problems.
My problem is, I want to be able to rewrite or replace the string TESTSERVER in the url with a different string (let say for example purposes the string is LIBRARY), such that the final page will end up looking like "https://LIBRARY:8080/lodi/home".
In effect, I am trying to hide the name of the real server which is TESTSERVER, and replace it with the name LIBRARY , when the page finally executes. This is for security purposes.
Secondly, will the new name LIBRARY have to be part of DNS for this to work , I was thinking , it could just be replaced.
6 Replies
- Brad_Parker_139
Nacreous
If you TESTSERVER(2) servers are defined as nodes and reachable via the LTM you could just do a rewite with a node selection rather than a redirect.
when HTTP_REQUEST { set req [string tolower [HTTP::uri]] if { $req starts_with "/lodi" } { node 8080 HTTP::uri /lodi/home } elseif { $req starts_with "/walking"} { node 8080 HTTP::uri /BOB/CAT } pool Test_Svrtier_Pool }Also, I'm not quite sure why you had the
between your IF statements so I put it at the end. Also, unless you are still running BigIP 4.x you don't need theuse pool Test_Svrtier_Pool
command.use- Shlairshe_84486
Nimbostratus
Thank Brad, I have not yet tested it but regarding the statement node 8080 Can this be replaced with a pool instead of server port ? - Brad_Parker_139
Nacreous
Absolutely can be, just use pool .
- Brad_Parker
Cirrus
If you TESTSERVER(2) servers are defined as nodes and reachable via the LTM you could just do a rewite with a node selection rather than a redirect.
when HTTP_REQUEST { set req [string tolower [HTTP::uri]] if { $req starts_with "/lodi" } { node 8080 HTTP::uri /lodi/home } elseif { $req starts_with "/walking"} { node 8080 HTTP::uri /BOB/CAT } pool Test_Svrtier_Pool }Also, I'm not quite sure why you had the
between your IF statements so I put it at the end. Also, unless you are still running BigIP 4.x you don't need theuse pool Test_Svrtier_Pool
command.use- Shlairshe_84486
Nimbostratus
Thank Brad, I have not yet tested it but regarding the statement node 8080 Can this be replaced with a pool instead of server port ? - Brad_Parker
Cirrus
Absolutely can be, just use pool .
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com