Forum Discussion
Problems with a rewrite. Please help
Hi, I've been asked to write an irule that will intercept anything with a uri that begins with /upload and remove the /upload.
Also, the rule needs to rewrite the host from whatever it is to be the hostname of the server in the pool that it gets served by and to also have :8080 added to it.
https://images.blah.com/upload/document-delivery/uploadfile
to be rewritten to
http://hostname:8080/document-delivery/uploadfile
So far I have come up with this:
when HTTP_REQUEST {
set origuri [HTTP::uri]
if { $origuri starts_with "/upload" } {
HTTP::uri [string range $origuri 7 end]
pool pool1
}
}
which I thought would at least remove the /upload part of the URI but it doesn't seem to.
Any help is greatly appreciated.
- hooleylistCirrostratusHi David,
when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: Original request: [HTTP::host][HTTP::uri]" if { [HTTP::uri] starts_with "/upload" } { HTTP::uri [string range [HTTP::uri] 7 end] pool pool1 } } when HTTP_REQUEST priority 501 { log local0. "[IP::client_addr]:[TCP::client_port]: Current request: [HTTP::host][HTTP::uri]" }
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