Forum Discussion

Kevin_Nail's avatar
Kevin_Nail
Icon for Nimbostratus rankNimbostratus
Feb 08, 2007

Simple URL host rewrite

I am trying to do a simple rewrite of the URL host. Currently when users type in the following: "https://mydomain.state.company.com" they are getting a security alert screen complaining that the name doesn't match the certificate. The certificate was generated with the name "mydomain.company.com"

 

 

I am trying to rewrite the URL so that host part of incoming requests will get changed to "mydomain.company.com"

 

However I can't seem to get it working right. The log never shows the rewrite. Am I missing something here? Any help would be appreciated.

 

 

Here is my rule

 

 

when HTTP_REQUEST {

 

if {[HTTP::host] contains "state.company.com"} {

 

HTTP::header replace "Host" "mydomain.company.com"

 

log local0. "This is the new host: [HTTP::host]"

 

}

 

}

 

 

The log is showing:

 

Feb 8 10:41:04 tmm tmm[706]: Rule myrule_rewrite : This is the new host: mydomain.state.company.com

 

3 Replies

  • Thanks for the information.

     

     

    I tried the code you suggested but to no avail. The redirect to https is not working either. I am still seeing the security alert.

     

    Any other ideas?

     

     

    Thanks,

     

    Kevin
  • Thanks Colin,

     

     

    That kind of coding is beyond my understanding at this point. Can you give an example?

     

     

    Regards,

     

    Kevin
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Actually, you wouldn't even need coding for this. I'd recommend looking into the stream profile if you're looking to re-write the HTTP payload the server is responding with. There is some good documentation of this in the user guides, I believe.

     

     

    Colin