Forum Discussion
6 Replies
- Mui_64918Cirrus
Which version are you using? You dont have to use getfield. The following will work when HTTP_REQUEST { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } in the above example the ":" is the delimiter in the getfield and you are requesting first field in it. you dont have to do that as HTTP::host returns the hostname.
- Aaron_Forster_3Historic F5 Account
Check the description in the docs for getfield.
To extract only the hostname from the host header (strips any trailing ":" port specification)
HTTP::host returns the host portion. The 'host' portion of the request can include an optional port.
So if your application's non-https port is anything other than 80 the request will look like:
http://example.com:9090/path/to/page
https://[HTTP::host][HTTP::uri]
would then redirect the user to:
https://example.com:9090/path/to/page
which isn't going to work.
It's not neccesary if you are applying it to a VIP on port 80. If you leave in the getfield you can use it for vips on any port.
- Cae_140395Nimbostratus
Mui,
I'am using BIG-IP LTM 11.5.0. In the irule that you passed the part "https://[HTTP::host][HTTP::uri]" should really be in quotes ?
Tks again!
- Mui_64918Cirrus
you dont need the quotes when HTTP_REQUEST { HTTP::redirect https://[HTTP::host][HTTP::uri] } as long as you are using standard service ports in teh front end you dont need to use getfield.
- Cae_140395Nimbostratus
Thanks Mui and Aaron !It was useful informations !
- IheartF5_45022Nacreous
Hi - even if you are using a standard port, some clients (not usually a browser - a probe for example) can choose to include a port number in a request, so if you want to be super-dooper correct use getfield to prevent https://site.com:80/blah from being returned in a Location header. Also as Aaron says - if you leave it in it's a one size fits all iRule....