Forum Discussion
Jesper_Hedin_42
Nimbostratus
Dec 16, 2005Change a 302 response header
Hello.
I wonder how to write an iRule that rewrites this HTTP response header:
Location: http://domain.com:8080/application-1.0/appLogin.do
to this one:
Location: https://domain.com/application-1.0/appLogin.do
I am new to this and i have tried a lot but I just can not make it work. Any ideas?
...Jesper
- Jesper_Hedin_42
Nimbostratus
Nevermind. I just found an honorable mention from the iRules contest that fixed my problem right away. Thanks, Juha Ranta for your iRule http_rewrite. It made my day. - Jason_Adams
Employee
This is old...but I haven't been able to find anywhere else where this has been addressed:
This may be ugly; but I believe it will get the job done.
** Note, this will not redirect from HTTP to HTTPS -- It will only remove the :PORT designation **
Please post a comment if you have found a better way to remove the port designation from an HTTP 302 Location Header.
when HTTP_RESPONSE { if { [HTTP::is_redirect] } { HTTP::header replace Location "[URI::protocol [HTTP::header Location]]://[URI::host [HTTP::header Location]][URI::path [HTTP::header Location]][URI::basename [HTTP::header Location]]?[URI::query [HTTP::header Location]]" } }
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects