Forum Discussion
Hostname turns into server internal name
Hi Everyone,
We have a customer and they have interesting issue on their application side.
When we send a http request to the VIP, firstly related hostname appears in the browser then 2-3 seconds later hostname turns into server internal name which is unwanted case for customer.
Is there any way to prevent this stuation ?
Regards,
- Kevin_Davies
Nacreous
If you open developer tools in the browser do you see a 302 redirect? If you do, what is the value for Location?
- Hamish
Cirrocumulus
Sounds like a redirect by the internal server. You can configure redirect rewrites to take care of that
- Stanislas_Piro2
Cumulonimbus
The problem is we don’t know if the server returns the external name in redirect only or in all http response links.
The best solution is to look at the server configuration if you can set the external url. Most of http server support it and it will increase f5 performances instead of irule inspecting all response pages.
- Kevin_Davies
Nacreous
Create a HTTP profile, enable Redirect Rewrites to All.
- Seckin_149390
Nimbostratus
Hi All,
Thanks for you replies. I suspect from the internal server doing this redirection but i do not know exact reason.
I will check more detail and inform you.
Hi Kevin by the way, there is a redirection irule on VIP like ;
if [HTTP::uri] equals "/" do HTTP::redirect "/blabla"
Regards,
- Kevin_Davies_33
Nimbostratus
Its pretty standard for most appplication to have redirects of some sort. The F5 can remap the destination using that setting in HTTP profile.
- Seckin_149390
Nimbostratus
Hi Kevin, yeah it's maybe from the application but i need to fix this one. From your previous answer, you were mention about Redirect Rewrite but issue is not related to http to https redirect.
- Kevin_Davies_33
Nimbostratus
If that does not help you then you can try the following simplified code to solve your problem. This will ensure that all redirects relative. This takes http://mylocal.server.com/anyway?hello=1 and makes it /anyway?hello=1. This means it will not longer change the name of the server in the browser.
when HTTP_REQUEST { if {[HTTP::status] eq 302} { if {[HTTP::header Location] starts_with "http"} { HTTP::header replace Location "/[getfield [HTTP::header Location] {/} 4]" } } }
- Hamish
Cirrocumulus
If you're unsure what's being sent back from the backend, run a tcpdump from the command line, and capture to a file (-w option), grabbing the full packet (-s 0 == don't truncate the snap) and then peruse the response either via tcpdump, or if you're more desktop orientated using something like wireshark
Often seeing exactly what is coming back can be a good hint as to why it's doing that
- Seckin_149390
Nimbostratus
Hi,
Here is the full description ;
We have 2 VIPs, first one is http VIP and used for only https redirection works ok. Second one is https and SSL offlading comes here. Also, there is a irule on https VIP to redirect another path comes from client which works ok too ;
when HTTP_REQUEST { if { [HTTP::path] equals "/" } { HTTP::redirect "/sap/bc/ui5_ui5/ui2/ushell/shells/abap/FioriLaunchpad.html" } }
This is the Client, F5 and Server connection ;
Client <-----> F5 (HTTPS, Redirect IRule) <-----> Server (HTTP, 8000)
By the way, this is SAP application.
Some test from browser checking headers ;
- Request URL: https://bgmdvfiop1.internal.borusan.com/sap/bc/ui5_ui5/ui2/ushell/shells/abap/FioriLaunchpad.html
- Request Method: POST
- Status Code: 200 OK
- Remote Address: 10.10.37.96:443
- Referrer Policy: no-referrer-when-downgrade
- Response Headersview source
- cache-control: no-cache, no-store
- content-encoding: gzip
- content-length: 5937
- content-type: text/html; charset=utf-8
- expires: 0
- pragma: no-cache, no-store, private
- set-cookie: sap-login-XSRF_MFP=20171019122612-50hLB1TbswKM3cngRpnojg%3d%3d; path=/; HttpOnly
- set-cookie: sap-usercontext=sap-language=TR&sap-client=400; path=/
- Request Headersview source
- Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8
- Accept-Encoding: gzip, deflate, br
- Accept-Language: tr-TR,tr;q=0.8,en-US;q=0.6,en;q=0.4
- Cache-Control: no-cache
- Connection: keep-alive
- Content-Length: 291
- Content-Type: application/x-www-form-urlencoded
- Host: bgmdvfiop1.internal.borusan.com
- Origin: https://bmgsfiori.borusan.com
- Pragma: no-cache
- Referer: https://bmgsfiori.borusan.com/sap/bc/ui5_ui5/ui2/ushell/shells/abap/FioriLaunchpad.html
- Upgrade-Insecure-Requests: 1
- User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
- Stanislas_Piro2
Cumulonimbus
You provided the real URL, so I tried to look at it and it seems there is no internal or external hostname reference, all URLs are relative.
did you enable the irule I provided?
Do you still have the issue?
- Seckin_149390
Nimbostratus
Hi Stanislas,
Related service is not on production and we will try this one by using hosts file on windows, i will try today and inform you. Many thanks for your
Best regards
- Seckin_149390
Nimbostratus
Hi Stanislas,
Did you mean this irule ;
when HTTP_RESPONSE { if {[HTTP::status] starts_with 30} { if {[HTTP::header Location] starts_with ";} { HTTP::header replace Location "/[join [lrange [split [HTTP::header Location] {/}] 3 end] {/}]" } } }
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