Forum Discussion
Irule Transparent Ridiredt
I have a user type http://elmdemo.access.com and need it to redirect to http://elmdemo1.access.com :6000/elmdemo/sighno.html. I have the redirct working, but it changes the users URL in the browser. I need to redirect them to the long URL with out the URL in there browser changing from http://elmdemo.access.com.
Mike
6 Replies
- nitass
Employee
is it something like this?[root@ve10:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.19.252:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve10:Active] config b pool foo list pool foo { members 200.200.200.101:6000 {} } [root@ve10:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { HTTP::header replace Host "elmdemo1.access.com" if { [HTTP::uri] eq "/" } { HTTP::uri "/elmdemo/sighno.html" } } } test [root@ve10:Active] config ssldump -Aed -nni 0.0 port 80 or port 6000 New TCP connection 1: 172.28.19.251(43427) <-> 172.28.19.252(80) 1363006712.5002 (0.0010) C>S --------------------------------------------------------------- GET / HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: elmdemo.access.com Accept: */* --------------------------------------------------------------- New TCP connection 2: 200.200.200.10(43427) <-> 200.200.200.101(6000) 1363006712.5010 (0.0006) C>S --------------------------------------------------------------- GET /elmdemo/sighno.html HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: elmdemo1.access.com Accept: */* --------------------------------------------------------------- - Kevin_Stewart
Employee
This is a very good scenario for ProxyPass (https://devcentral.f5.com/wiki/iRules.proxypassv10.ashx). - Mike_Watson_125
Nimbostratus
Here is my curent Irule. I just don't want the users browser to show anything bu http://elmdev.accessmidstream.net. Sorry had to change to Dev pool for testing. So user types in http://elmdev.accessmidstream.net adn it redirects to http://elmdev1.accessmidstream.net:6000/elmdev/signon.html but I don't want user to know that they have been redirected.
when HTTP_REQUEST {
if { [HTTP::path] equals "/" } {
HTTP::redirect "http://elmdev1.accessmidstream.net:6000/elmdev/signon.html"
}
}
- Kevin_Stewart
Employee
As nitass indicated, At the very least the HTTP::header replace Host and HTTP::uri commands will transparently change the Hosts header and URI on the ingress flow. The HTTP::redirect command sends the user a physical 302 redirect (which alters the browser URL). There are some potentially dangerous assumptions being made though:
1. Any request for "/" will need to be redirected to "/elmdev/signon.html"
3. The application server isn't sending back any references to its physical location and paths in references to embedded objects and redirects
For a more robust solution that handles all of the translations between the client side and server side (hosts, port, URIs, pools, etc.), please take a look at the ProxyPass iRule. - Mike_Watson_125
Nimbostratus
Can someone give an example of how to configure proxy pass for this?
- Kevin_Stewart
Employee
All of the documentation and some config examples are embedded in the ProxyPass iRule.
https://devcentral.f5.com/wiki/iRules.proxypassv10.ashx
Essentially you'll load up and apply the iRule, then create a data group of a specific name that contains the public and private side mappings.
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