Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

URL edit

Mohamedabogamil
Nimbostratus
Nimbostratus

Dear 

I need to send the request as is to the backend server but the client should see another URI and shouldn't see the port number but the same time port number shouldn't be modified when f5 sends this request to the backend servers

I have VS 1.1.1.1:4443 and backend servers work on 2.2.2.2:4443.

The URL is https:example.com:4443/OA_HTML/APPSlocalLogn.jsp 

I need to remove the word " local" and port 4443 from the URL  to be set it such as https:example.com/OA_HTML/APPSLogn.jsp 

Is there any way to make this request? 

Thanks 

6 REPLIES 6

Hi @Mohamedabogamil , 

Use this irule : 

when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/OA_HTML/"} {
HTTP::host [string map {":4443" ""}[HTTP::host]]
HTTP::uri [string map {"local" ""}[HTTP::uri]]

log local0. " the new URL >> [HTTP::host][HTTP::uri] "
}
}

Note : iRules consume CPU cycles , so keep your eyes in your system resourses for any spikes after applying this irule. 

This irule should meet your requirements and here below the output from /var/log/ltm file

[root@bigipA:Active:Standalone] config # tac /var/log/ltm |grep -i "rule"  
Nov 12 04:12:35 bigipA info tmm[16702]: Rule /Common/Replace <HTTP_REQUEST>:  the new URL >> 10.1.10.35/OA_HTML/APPSLogn.jsp 
[root@bigipA:Active:Standalone] config # 


I hope you find this insightful 🙂 

_______________________
Regards
Mohamed Kansoh

@Mohamedabogamil , 

If you need to omit the removed parts in the URL from appearing in the browser, 
I believe you can use redirection and clone the same Virual server but with the https /443 port. 

here this editied irule : 

when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/OA_HTML/"} {
HTTP::host [string map {":4443" ""}[HTTP::host]]
HTTP::uri [string map {"local" ""}[HTTP::uri]]
log local0. " the new URL >> [HTTP::host][HTTP::uri] "
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
_______________________
Regards
Mohamed Kansoh

Hi Mohamed thanks for the replay i will explain the problem in a better way

 I need to send the request as is to the backend server

(The URL is https:example.com:4443/OA_HTML/APPSlocalLogn.jsp )

but the client should see another URI and shouldn't see the port number

(The URL is https:example.com/OA_HTML/APPSLogn.jsp )

but same time port number shouldn't be modified when f5 sends this request to the backend servers

did your solution match with this scenario 

Hi @Mohamedabogamil , 

Thanks for response and letting me know. 

>> To change the URL in the browser page , you need to rely on redirection to make the URL appears like this ( https:example.com/OA_HTML/APPSLogn.jsp ) and this is what I did in the irule. 

>> To deliver the request without modifications to Backend servers behind Bigip , you can do this using " HTTP_REQUEST_SEND " event , as it triggeres in server side connections prior to sending http requests to pool members. 
What I am trying to say : 
1- Do that modification , and use redirect >>> Client HTTP_REQUEST event.
2- Revert back all modifications under HTTP_REQUEST_SEND event , so you can send the request like this " <pool_member_IP>:4443/OA_HTML/APPSlocalLogn.jsp

So I see first you need redirection to to change the sahpe of URL in the web browser.

Tell me if you agree on the redirection , I can complete the irule syntax and share it.

by the way , you can create another VS listen on port 443 to recieve  the traffic after redirection and attach same pool "4443" and bigip will do destination port translation by default. after that you will attach the new irule that manuplates in server side requests within this VS. 

_______________________
Regards
Mohamed Kansoh

Hi @Mohamedabogamil 
- assign your :4443 pool.
- then to assign this LTM policy to your VS.

Screenshot (830).png

 

T-Trust
MVP
MVP

Hi Mohamedbogamil,

So i think you can using this step for ror this solution,

1. on virtual server you can use service port 443 and check port translate on virtual server for translate to member port 4443

2. Try irule about http replace uri

I hope this step will help you

Best Regards