1

I am trying to set up what i believe needs to be a reverse proxy in Apache 2.

I have apache set up and i have Mod_proxy,mod_ssl,Mod_rewrite all enabled.

i am trying to control a media player through its HTTPS web page, it does not allow http connections. Unfortunately the contol system does not do Https. it technically doesn't even really do http (it is not a browser). although I can form HTTP packets and parse the responses. I do this regularly with other products.

so what i want to do is send a HTTP request to my apache2 server at 192.168.0.17:80, have the Apache server forward that request to the HTTPS media server at 192.168.0.12:443. and then return the resulting source code back to the original client in plain text for parsing. Once the info is parsed i will use it to fill variables and then use those varible to generate the a http packet to simulate some one clicking particular GUI elements.

All machines are on a local network dedicated to the control system and while it does have a internet connection I don't need to have the proxy handle any requests from the wan side, In fact i only need the proxy to handle requests from a single local IP address.

I know i need to set up a virtual host file that is something like this

<VirtualHost 1.2.3.4:80>
ServerName foo.com
SSLProxyEngine On
SSLProxyCheckPeerCN on
SSLProxyCheckPeerExpire on
ProxyPass / https://secure.bar.com
ProxyPassReverse / https://secure.bar.com

But just cant wrap my head around what IP info needs to go where or what other setting i might need to change.

As a side question, is there anyway to script apache to maintain the login on the https server and re authenticate if session times out? I will likely be polling the server every few seconds for some of my feedback elements but it would still be nice to off load the login process to apache if possible

Thanks for any help. I now have exactly 4 hours of experience with raspberry pi and apache.

new2apache
  • 21
  • 1

2 Answers2

0

You are doing it wrong.

` ServerName foo.com RewriteEngine on RewriteRule ^/(.*)$ https://secure.bar.com/$1 [P,L]

Plus <VirtualHost *> simplier and sexier in general (of course NameVirtualHost * must be present).

drookie
  • 8,625
  • 1
  • 19
  • 29
0

You were close.

<VirtualHost 1.2.3.4:80> 
ServerName foo.com
SSLProxyEngine on 
ProxyPass / https://secure.bar.com/      
ProxyPassReverse / https://secure.bar.com/

If the site has the host hard coded you can use most of my example from here, just be sure to use HTTPS and SSLProxyEngine On

Jacob Evans
  • 7,886
  • 3
  • 29
  • 57