Apache reverse proxy forwarding https header

Discussion in 'Server Operation' started by volf, Feb 20, 2013.

  1. volf

    volf New Member

    I have successfully installed reverse proxy on Apache. It works like a charm. I'm using it to proxy https request to http. My problem is that I need to forward variable SERVER_HTTPS to my end server, to indicate if person is using ssl connection or just http. I have found one way to do: Each time I can forward HTTP_X_FORWARDED_PROTO variable and check on end server:

    if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
    $_SERVER['HTTPS']='on';

    But this variant is not good for me, because I can't edit the end servers scripts. Lets say that I don't even have access to it. But I know how to check if it is forwarded. So, Generally my question is: Is there any way that I can forward this variable? I have seen one more variant, with Rewrite engine , but it didn't work for me and there is no detailed information. Maybe If I will set my server on Nginx + apache this will send this header variable?
     
  2. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    On an nginx reverse proxy, you would also set

    Code:
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    so I guess this makes no difference.
     

Share This Page