Forum Discussion
Need help of I-rule rewrite
Need Help on HTTP rewrite i-rule
Actual server is listening on port 7778 .I created pool of two real servers listening on port 7778
But when the user type http://lmjedwmsaphchh.jeddah.cpksa.local url should get rewrite to http://lmjedwmsaphchh.jeddah.cpksa.local:7778/forms/frmservlet?config=wmshcrdc-hh but the user should only see http://lmjedwmsaphchh.jeddah.cpksa.local/forms/frmservlet?config=wmshcrdc-hh
I tried by
when HTTP_REQUEST { if {[string tolower [HTTP::host]] starts_with "lmjedwmsaphchh.jeddah.cpksa.local"}{ HTTP::header replace Host "lmjedwmsaphchh.jeddah.cpksa.local:7778" } } when HTTP_RESPONSE {
if {[HTTP::is_redirect]}{ [string map {lmjedwmsaphchh.jeddah.cpksa.local:7778 lmjedwmsaphchh.jeddah.cpksa.local} [HTTP::header value Location]] HTTP::header value Location [string map {lmjedwmsaphchh.jeddah.cpksa.local:7778 lmjedwmsaphchh.jeddah.cpksa.local} [HTTP::header value Location]] } }but its not working
Regds...Indrajit
14 Replies
- nitass
Employee
Actual server is listening on port 7778 .I created pool of two real servers listening on port 7778
But when the user type http://lmjedwmsaphchh.jeddah.cpksa.local url should get rewrite to http://lmjedwmsaphchh.jeddah.cpksa.local:7778/forms/frmservlet?config=wmshcrdc-hh but the user should only see http://lmjedwmsaphchh.jeddah.cpksa.local/forms/frmservlet?config=wmshcrdc-hh
have you tried without irule?
- Indrajit_Basak_
Nimbostratus
Yes without I-rule it is working perfect .
Means if user browse http://lmjedwmsaphchh.jeddah.cpksa.local:7778/forms/frmservlet?config=wmshcrdc-hh page is opening perfectly.
But our requirement is user should only type http://lmjedwmsaphchh.jeddah.cpksa.local same page should open .
Regds..Indrajit
- nitass_89166
Noctilucent
sorry to not explain well.
you have virtual server listening on port 80 (without irule) and lmjedwmsaphchh.jeddah.cpksa.local is resolved to virtual server ip, isn't it?
if yes, does browsing http://lmjedwmsaphchh.jeddah.cpksa.local/forms/frmservlet?config=wmshcrdc-hh work?
- Indrajit_Basak_
Nimbostratus
Hi Nitas , you are right . lmjedwmsaphchh.jeddah.cpksa.local is resolved to virtual IP and if user browses http://lmjedwmsaphchh.jeddah.cpksa.local:7778/forms/frmservlet?config=wmshcrdc-hh it works . But our requirement is User should only browse http://lmjedwmsaphchh.jeddah.cpksa.local and through i-rule it should be redirected to http://lmjedwmsaphchh.jeddah.cpksa.local:7778/forms/frmservlet?config=wmshcrdc-hh Regds..Indrajit - nitass_89166
Noctilucent
does browsing http://lmjedwmsaphchh.jeddah.cpksa.local/forms/frmservlet?config=wmshcrdc-hh (no :7778, no irule) work? - Indrajit_Basak_
Nimbostratus
No Its not working ..... Regds...Indrajit
- nitass
Employee
sorry to not explain well.
you have virtual server listening on port 80 (without irule) and lmjedwmsaphchh.jeddah.cpksa.local is resolved to virtual server ip, isn't it?
if yes, does browsing http://lmjedwmsaphchh.jeddah.cpksa.local/forms/frmservlet?config=wmshcrdc-hh work?
- Indrajit_Basak_
Nimbostratus
Hi Nitas , you are right . lmjedwmsaphchh.jeddah.cpksa.local is resolved to virtual IP and if user browses http://lmjedwmsaphchh.jeddah.cpksa.local:7778/forms/frmservlet?config=wmshcrdc-hh it works . But our requirement is User should only browse http://lmjedwmsaphchh.jeddah.cpksa.local and through i-rule it should be redirected to http://lmjedwmsaphchh.jeddah.cpksa.local:7778/forms/frmservlet?config=wmshcrdc-hh Regds..Indrajit - nitass
Employee
does browsing http://lmjedwmsaphchh.jeddah.cpksa.local/forms/frmservlet?config=wmshcrdc-hh (no :7778, no irule) work? - Indrajit_Basak_
Nimbostratus
No Its not working ..... Regds...Indrajit
- Kevin_Stewart
Employee
At a minimum there's an iRule syntax issue:
when HTTP_REQUEST { if { [string tolower [HTTP::host]] starts_with "lmjedwmsaphchh.jeddah.cpksa.local" } { HTTP::header replace Host "lmjedwmsaphchh.jeddah.cpksa.local:7778" } } when HTTP_RESPONSE { if { [HTTP::is_redirect] } { HTTP::header replace Location [string map {"lmjedwmsaphchh.jeddah.cpksa.local:7778" "lmjedwmsaphchh.jeddah.cpksa.local"} [HTTP::header Location]] } }
This will account for the incoming Host header and any outgoing redirect Location headers. If it still doesn't work, I'd do a capture of the traffic on the client side to see if other :7778 references are getting through to the client (ie. document object references).
- Kevin_Stewart
Employee
Concur with Nitass. You need to look at the HTTP responses from the server to see if elements within the response contain the offending URL pattern. Changing the Location header may not be enough if elements within the payload also have the "real" path (image links, CSS, JavaScript, etc.).
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