Forum Discussion

Seckin_149390's avatar
Seckin_149390
Icon for Nimbostratus rankNimbostratus
Oct 18, 2017

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,

 

21 Replies

  • If you open developer tools in the browser do you see a 302 redirect? If you do, what is the value for Location?

     

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus

    Sounds like a redirect by the internal server. You can configure redirect rewrites to take care of that

     

  • 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.

     

  • 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's avatar
      Kevin_Davies_33
      Icon for Nimbostratus rankNimbostratus

      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's avatar
      Seckin_149390
      Icon for Nimbostratus rankNimbostratus

      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's avatar
      Kevin_Davies_33
      Icon for Nimbostratus rankNimbostratus

      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's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus

    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

     

  • 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 ;

     

    1. Request URL: https://bgmdvfiop1.internal.borusan.com/sap/bc/ui5_ui5/ui2/ushell/shells/abap/FioriLaunchpad.html
    2. Request Method: POST
    3. Status Code: 200 OK
    4. Remote Address: 10.10.37.96:443
    5. Referrer Policy: no-referrer-when-downgrade
    6. Response Headersview source
    7. cache-control: no-cache, no-store
    8. content-encoding: gzip
    9. content-length: 5937
    10. content-type: text/html; charset=utf-8
    11. expires: 0
    12. pragma: no-cache, no-store, private
    13. set-cookie: sap-login-XSRF_MFP=20171019122612-50hLB1TbswKM3cngRpnojg%3d%3d; path=/; HttpOnly
    14. set-cookie: sap-usercontext=sap-language=TR&sap-client=400; path=/
    15. Request Headersview source
    16. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8
    17. Accept-Encoding: gzip, deflate, br
    18. Accept-Language: tr-TR,tr;q=0.8,en-US;q=0.6,en;q=0.4
    19. Cache-Control: no-cache
    20. Connection: keep-alive
    21. Content-Length: 291
    22. Content-Type: application/x-www-form-urlencoded
    23. Host: bgmdvfiop1.internal.borusan.com
    24. Origin: https://bmgsfiori.borusan.com
    25. Pragma: no-cache
    26. Referer: https://bmgsfiori.borusan.com/sap/bc/ui5_ui5/ui2/ushell/shells/abap/FioriLaunchpad.html
    27. Upgrade-Insecure-Requests: 1
    28. 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's avatar
      Stanislas_Piro2
      Icon for Cumulonimbus rankCumulonimbus

      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's avatar
      Seckin_149390
      Icon for Nimbostratus rankNimbostratus

      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's avatar
      Seckin_149390
      Icon for Nimbostratus rankNimbostratus

      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] {/}]" } } }