Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to proxy http to https using Apache httpd (v2.2) [closed]

I'm trying to set up a simple proxypass in Apache httpd that will proxy certain requests. Here is what I have tried, but it doesnt seem to like the change from http to https?

ProxyPass /maps https://maps.googleapis.com/maps

Perhaps I am missing an extra step?

I have read a little about setting up certificates but this seems to be long winded for such a simple task?

The result I get currently is a 500 error.

like image 522
Jeremy Avatar asked Apr 21 '13 10:04

Jeremy


People also ask

Does Apache act as a proxy server?

In addition to being a "basic" web server, and providing static and dynamic content to end-users, Apache httpd (as well as most other web servers) can also act as a reverse proxy server, also-known-as a "gateway" server.

How does Apache support proxy?

Apache Working As A Reverse-Proxy Using mod_proxy Some of these modules are: mod_proxy: The main proxy module for Apache that manages connections and redirects them. mod_proxy_http: This module implements the proxy features for HTTP and HTTPS protocols. mod_proxy_ftp: This module does the same but for FTP protocol.

What is Apache HTTP proxy?

Apache HTTP Proxy is a proxy service that can be used to distribute updates to client computers. Apache HTTP Proxy performs a similar role to the mirror server feature popular in ERA 5 and earlier. To install Apache HTTP Proxy, read the instructions for Windows, Linux, or Virtual Appliance.

What is ProxyPass and ProxyPassReverse in httpd conf?

The "ProxyPass" and "ProxyPassReverse" parameters are used to tell Apache how to proxy requests. They require the "mod_proxy.so" and "mod_proxy_http.so" Apache modules, which are loaded by default in RHEL5 and RHEL6, but check the following lines are uncommented in the "/etc/httpd/conf/httpd. conf" file to make sure.


1 Answers

Ok after reading many solutions that involved setting up certificates, and virtual hosts etc etc. I finally found a basic config that does not require any of that.

Here is what I have used to access proxy autocomplete google places requests through local host on an installation of Apache including ssl support (version 2.2 for windows).

Edit the apache file httpd.conf

turn on the required modules...

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule ssl_module modules/mod_ssl.so

go to the bottom of the file and add the following configuration for mod_proxy...

<IfModule mod_proxy.c>

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

SSLProxyEngine on
ProxyPass /maps https://maps.googleapis.com/maps
ProxyPassReverse /maps https://maps.googleapis.com/maps

</IfModule>

Thats it, the rest was all default configuration settings from when I installed Apache.

Further configuration details relating to apache proxy can be found at the Apache mod_proxy docs.

General Apache docs for version 2.2.

like image 73
Jeremy Avatar answered Oct 12 '22 01:10

Jeremy