Forum Discussion

BKA_201457's avatar
BKA_201457
Icon for Nimbostratus rankNimbostratus
Nov 09, 2015

Reverse proxy - transparency to client

Good day F5ers. I am still looking for a solution to my customers request. Here is what they want me to do, and I have no idea where to start, or if its at all possible.

 

Here goes. They want us to reverse proxy only an external blog to our internal website. For instance:

 

The domain example (internal site): www2.hogleg.com The blog site (external): www.topquartile.com

 

So when a client clicks on the blog link for www2.hogleg.com it takes them to www2.hogleg.com/en-us/blog/topquartile/, but they dont want to URL to change, yet pull the blog from an external site ( SO when you go to www2.hogleg.com/en-us/blog/topquartile/, you will actually be on but you will appear to be at ww2.hogleg.com/en-us/blog/topquartile/.

 

One more thing. I was going to do this by adding the external server to a pool and then point at the pool for /en-us/blog/topquartile/, but the external server is shared, and I cannot get to it by IP, only DNS name. I would assume need to reverse proxy this, but I think there is some header manipulation too. Can someone give me an idea of where to start? Thanks F5ers.

 

B

 

8 Replies

  • R_Marc's avatar
    R_Marc
    Icon for Nimbostratus rankNimbostratus

    Yes, you can do that. Pretty simple to do via an iRule.

     

    There much less complicated ways to do this but this one is comprehensive but you can, at least, steal the necessary bits or concepts from it to create a custom iRule.

     

  • Thanks R Marc. Does anyone have a sample configuration? I trying to figure out where to start. I can usually fumble my way through it if I have an example.

     

  • Also, R Marc. What are the other easier methods you are referring to?

     

  • Here is what I have in the lab now. Its not working, but I am sure I am missing something.

    when HTTP_REQUEST {
        if {[HTTP::uri] equals "/en-us/blog/topquartile"}{
        HTTP::host "www.topquartile.com"
        pool pool_www.topquartile.com-http
        }
    }
    
    
    Anyone, anyone, bueller, bueller....
    
    Thanks.
    
    
    Brett
    
  • R_Marc's avatar
    R_Marc
    Icon for Nimbostratus rankNimbostratus

    Putting in an answer rather than a comment on the thread since comments don't format the same way:

    You are just changing the host header there (which you may need to do just depends on if the backend does anything with the host header) and assigning the request to a particular pool. Is it safe to assume that www.topquartile.com/en-us/blog/topquartile is a valid url and the pool members in pool_www.topquartile.com-http are the ones responsible for www.topquartile.com?

    If so, I don't see anything wrong with that, but often of times there is a location redirect on blogs to what they think their name is. You'd have to intercept that and change it. You can log the response headers and see what it's sending.

    when HTTP_RESPONSE {
               log local0. "============================================="
               foreach aHeader [HTTP::header names] {
                            log local0. "$aHeader: [HTTP::header value $aHeader]"
               }
               log local0. "============================================="
            }
    }
    

    If you see a 301 or 302, you'll need to modify the location redirect in the response. String map is the easiest way to do that:

    HTTP::header replace Location [string map {someurl anotherurl} [HTTP::header Location]]
    
  • when HTTP_RESPONSE {
            log local0. "scooby.doo"
            foreach aHeader [HTTP::header names] {
            log local0. "$aHeader: [HTTP::header value $aHeader]"
            }
            log local0. "scooby.dumb"
            }
    }
    
    
    This is not working.  I get an error on line 3.  (foreach aHeader [HTTP::header names] {)
    I am new at iRules, so pardon my ignorance.  
    
    • R_Marc_77962's avatar
      R_Marc_77962
      Icon for Nimbostratus rankNimbostratus
      There's nothing wrong with that line, though you have one two many curly brackets there (which was from my original...I probably cut and pasted too much).
  • "Is it safe to assume that www.topquartile.com/en-us/blog/topquartile is a valid url and the pool members in pool_www.topquartile.com-http are the ones responsible for www.topquartile.com?" Yes the URL is similar. This isnt the exact URL, but close. I do have it pointing at pool_www.topquartile.com-http (cloud server). I dont think this is going to work though. I think I need to reverse proxy it, and manipulate the header to somehow think the client is on www.topquartile.com/en-us/blog/topquartile, when in fact its on www.topquartile.com (only when going to the blog).