Forum Discussion
HTTP redirect when http host end with no / slash
Hello,
I'm trying when HTTP access is no slash, redirect the specified page.
Example: http://www.example.com -> redirect A site. http://www.example.com/ -> redirect B site.
Can I use switch [HTTP::uri] ?
- youssef1
Cumulonimbus
Hello Tyranon,
whether you put a "/" or not in your request, it's exactly the same URI for F5:
http://www.example.com http://www.example.com/
You can try the following Irule and test both request, you will notice that in both case (request) you will see / in your logs:
when HTTP_REQUEST { log local0. "This is the HTTP URI [HTTP::uri]" }
So for me you can't redirect user for the use case that you have described. because in the 2 cases F5 will see a "/" whether you put it or not in your requests.
why do not you do it on other criteria? There is an imperative?
Regards
- Stanislas_Piro2
Cumulonimbus
Youssef is right, when requesting http://www.example.com, the http request is
GET / HTTP/1.1 Host: www.example.com
You can find this in http rfc
If the port is empty or not given, port 80 is assumed. The semantics are that the identified resource is located at the server listening for TCP connections on that port of that host, and the Request-URI for the resource is abs_path. If the abs_path is not present in the URL, it must be given as "/" when used as a Request-URI (Section 5.1.2).
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