Forum Discussion
Matt_108113
Nimbostratus
Mar 11, 2009IRules setting for http redirect then rewrite response
I am working with Oracle istore behind an F5 and basically we are trying to use the F5 as a reverse proxy and do something like this.
customer url: http://istore.cust.com
actual oracle istore url: http://hostname:8000/OA_HTML/ibeCAcdLogin.jsp?a=b
I wrote a rule to make the F5 forward requests from the customer to the actual url, but the customer sees the http://hostname:8000/OA_HTML/ibeCAcdLogin.jsp?a=b as the response of the redirect. How can I clean this up to make it pretty to the customer? I would like the customer to either only see the page as http://istore.cust.com or http://istore.cust.com/OA_HTML/ibeCAcdLogin.jsp?a=b but not as the actual hostname with the port 8000.
here is what I have for irules so far:
when HTTP_REQUEST {
HTTP::redirect "http://hostname:8000/OA_HTML/ibeCAcdLogin.jsp?a=b"
}
- hoolio
Cirrostratus
Here is an example which allows you to proxy an external site to an internal one by updating the domain in the requested host header and in the response Location header:when RULE_INIT { Set the hostname that the client makes request to (do not include protocol) set ::external_hostname "www.mycompany.co.uk" Set the hostname that the BIG-IP will rewrite requests to set ::internal_hostname "www.provider.com" Log debug messages to /var/log/ltm? 1=yes, 0=no. set ::proxy_site_debug 1 } when HTTP_REQUEST { if {$::proxy_site_debug}{log local0. "Received request from [IP::client_addr] -> [HTTP::host][HTTP::uri]"} if {$::proxy_site_debug}{log local0. "Rewriting [IP::client_addr]'s Host header to $::internal_hostname"} Rewrite the Host header HTTP::header replace "Host" $::internal_hostname } when HTTP_RESPONSE { Check if the status indicates a redirect if {[HTTP::is_redirect]} { if {$::proxy_site_debug}{log local0. "Rewriting [IP::client_addr]'s redirect to \ [string map -nocase $::internal_hostname $::external_hostname [HTTP::header Location]]"} Rewrite the Location header replacing the internal hostname with the external hostname HTTP::header replace Location [string map -nocase $::internal_hostname $::external_hostname [HTTP::header Location]] } }
- Shivam_84461
Nimbostratus
Hello Matt,
Did you get this working ?? I have a similar request and looking for irules to get this done..
Thanks SHivam
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