Forum Discussion

Bruce_Walker_11's avatar
Bruce_Walker_11
Icon for Nimbostratus rankNimbostratus
Jun 17, 2010

Setting header to signify https request

Hi there,

 

 

I have one https virtual server (443) that forwards on requests to a pool of servers on port 80. There is also a http virtual server (80) that sends requests on to the same pool of servers.

 

 

The application behind the https pool currently redirects to http, the developers have set their application to redirect to https if the X-Forwarded-Proto http header is set to = https.

 

 

I was wondering what iRule could be used to set X-Forwarded-Proto to equal https (similar to http://devcentral.f5.com/Forums/tabid/1082223/asg/50/showtab/groupforums/afv/topic/aff/5/aft/790661/Default.aspx)

 

for all requests that come into the https virtual server. I tried the one in that post with no success.

 

 

Thanks in advance,

 

 

Bruce

 

5 Replies

  • This isn't the answer you're looking for...but why not insert a different header and have them redirect to HTTPs based on that? Otherwise...you could simply rewrite the server's redirect response using an iRule or the "redirect rewrite" section of an HTTP profile...
  • You can do this simply with two custom HTTP profiles:

     

     

    http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=1171106&ptarget=1171135

     

     

    Aaron
  • Thanks for that Aaron- however just trying to figure out how the value is put into the http profile, under Request Header Insert (via the GUI)

     

     

    Currently I have:

     

     

    'X-Forwarded-Proto: https' This doesn't seem to be working, i'm sure it just the way I have it formatted (have tried "X-Forwarded-Proto: https")

     

     

    The relevant iRule line I had previously was: HTTP::header insert X-Forwarded-Proto "https"

     

     

    Any suggestions?

     

     

    Bruce
  • Hi Bruce,

     

     

    The HTTP profile should work fine for the header insert as you have it listed (without the single or double quotes). Do you get an error from the GUI or do you just not see the header in requests sent to the pool?

     

     

    Aaron