简体   繁体   中英

Apache reverse proxy to https server

I'm trying to setup reverse proxy to some web service, so I can develop JavaScript Ajax application on localhost. I have managed to do it with Apache following way:

ProxyPass /serviceproxy/ http://someservice.com/
ProxyPassReverse /serviceproxy/ http://someservice.com/
ProxyHTMLURLMap http://someservice.com/  /serviceproxy/

<Location /serviceproxy>
       ProxyPassReverse        /
       ProxyHTMLEnable On
       ProxyHTMLURLMap         / /serviceproxy/
       ProxyHTMLURLMap         http://someservice.com/
       RequestHeader    unset  Accept-Encoding
</Location>

That works fine for http webpages, but not for https pages. If I set proxy to https://someservice.com/ , Apache returns 500 Internal server error. I'm new to Apache configuration. How to make it work? Is it even possible?

thanks

You have to enable Ssl module (a2enmod ssl) Then in /etc/apache2/sites-available/default file include following lines

RequestHeader set X-Forwarded-Proto "https"
ServerName localhost
SSLProxyEngine On
RequestHeader set Front-End-Https "On"

Between line

ServerAdmin webmaster@localhost

and line

DocumentRoot /var/www

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM