Forum Discussion
piowis_321863
Nimbostratus
May 24, 2017Redirect when port 80 is visible in url
Hello, I am just wondering is it possible to get redirect only if port 80 in url is visible? I mean if application send url like sampleurl:80/sample/context redirect it to sampleurl:8889/sample/context
I have tried something like this if { ( [HTTP::host] contains ":80" ) and ( [HTTP::uri] starts_with "/sample/context" ) } { pool Sample_Pool_8889 }
Thanks in advance.
- Anesh
Cirrostratus
- do you want to redirect the url the user sees on the browser or send traffic to pool?
- Anesh
Cirrostratus
Try
when HTTP_REQUEST { if { ( [HTTP::host] contains ":80" ) and ( [HTTP::uri] starts_with "/sample/context" )} { HTTP::redirect https://[HTTP::host]:8889[HTTP::uri] } }
- Stanislas_Piro2
Cumulonimbus
Hi,
your irule seems right. Maybe you have to rewrite request host header:
when HTTP_REQUEST { if { ( [HTTP::host] contains ":80" ) and ( [HTTP::uri] starts_with "/sample/context" )} { HTTP::host "sampler:8889" pool Sample_Pool_8889 } }
- Ilian_Ivanov
Nimbostratus
Try with that one:
when HTTP_REQUEST { if { ( [HTTP::host] ends_with ":80" ) and ( [HTTP::uri] starts_with "/sample/context" ) } { HTTP::header replace Host "sampler:8889" pool Sample_Pool_8889 } else { pool Some_Other_Pool } }
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