Forum Discussion

eastmanpdx's avatar
eastmanpdx
Icon for Nimbostratus rankNimbostratus
Jul 14, 2019

HTTP::header replace Host rewrite

Hello,

 

I'm trying to rewrite the Host header such that the client is silently redirected to a host and the browser retains the original URL.

 

When I try this, I get a reset (presumably from abc.com). A redirect to abc.com works just fine.

 

Please help-thanks!

 

when HTTP_REQUEST_SEND {

HTTP::header replace Host "abc.com"

}

 

 

 

 

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    Eastmanpdx,

    How come you're using event HTTP_REQUEST_SEND? This is a server side event. You can use the "clientside" cmd here with this event, see Wiki Better to just use HTTP_REQUEST I believe

    See if that helps,

    N​

    • eastmanpdx's avatar
      eastmanpdx
      Icon for Nimbostratus rankNimbostratus

      Good question. I Saw HTTP_REQUEST_SEND in an example and decided to give it a try. I've also tried HTTP_REQUEST.

       

       

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    Might I suggest a packet capture to see what's going on? or add logging to the irule, you should be able to use the priority command and log before and after you http header change.

     

    Hope this helps,

     

    N

  • Thanks, nathe! I ran a tcpdump and saw that the LTM was sending a reset to the client due to their not being any pool members. This means that we were never taken to the page specified by the rewrites. I have attempted to implement this with Local Traffic Policies, irules and finally, a rewrite profile to no avail. I will be opening a case with F5 support.

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    Just to confirm, are you looking to rewrite the host header or actually redirect the client to a different host behind a different vip?

  • Just to be clear, I'm attempting to replace a redirect with a mechanism that takes the user to a different page completely transparently without the URL/URI in the user's browser changing.

    • nathe's avatar
      nathe
      Icon for Cirrocumulus rankCirrocumulus

      Sure. Then a rewrite should work. How come there are no pool members? A rewrite will still go to the same pool members assigned to the VIP. ​