Forum Discussion
iRule to add www without changing URL
- Jul 05, 2019
Do you want to change Host header sent from the client in server side connection or do you want to redirect the client to https://WWW.abc.com/testfolder/blahblahblah
to redirect the client, use following code
when HTTP_REQUEST { if {[HTTP::host] eq "abc.com"} { HTTP::redirect "https://www.abc.com[HTTP::uri]" } }
Depends what you want.. if you expicitly what to replace "abc.com" with "www.abc.com" you can use this iRule.
when HTTP_REQUEST {
if {[HTTP::host] eq "abc.com"} {
HTTP::header replace "Host" "www.abc.com"
}
}
If you want to add "www" to any host that doesn't have "www" then that's a different request, so a bit more context would be helpful.
Lee
- MihirP1129Jul 05, 2019Nimbostratus
Hi Lee, please see my response above of what I'm trying to accomplish.
- Lee_SutcliffeJul 05, 2019Nacreous
Have you tried your code? Reading your description above, it sounds like the iRule you supplied should work. Changing the incoming host header from abc.com to www.abc.com will leave the URi/Path intact
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