Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ProxyPass apache https to a node server

I'm trying to make a apache server a gateway for my node server.
My apache will serve the static pages and the node will act as rest api server.
Both the node and the apache sits on the same server , ubuntu 64bit ec2.

I've tried to do this for https and failed, later i've tried to open up a http port for the proxy pass and it worked ( I've changed the node to be http in order for that to work).

my last resort will be turning the node to the web server, but I wish to keep it simple since it will go refactor soon and use meteor.

I'll appreciate any suggestion

This is my configuration for the apache

<VirtualHost *:443>

    ServerName secure.mysite.co.il
    ServerAdmin [email protected]
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SSLEngine on
    SSLCertificateFile /ssl/mysite.crt
    SSLCertificateKeyFile /ssl/mysite.key
    SSLCertificateChainFile /ssl/ca-bundle-client.crt

    ProxyPreserveHost On
    ProxyRequests Off
    ProxyPass /echo/test https://127.0.0.1:8001/echo/test
    ProxyPassReverse /echo/test https://127.0.0.1:8001/echo/test

successfull http config

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName mysite.co.il
    ServerAlias www.mysite.co.il
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    ProxyPreserveHost On
    ProxyRequests Off
    ProxyPass / http://127.0.0.1:8001/
    ProxyPassReverse / http://127.0.0.1:8001/
</VirtualHost>
like image 818
Tal Avatar asked Jun 24 '26 19:06

Tal


1 Answers

SSLProxyEngine On needs to be declared to enable SSL for a reverse proxy config. This directive is documented here:

http://httpd.apache.org/docs/2.2/mod/mod_ssl.html#sslproxyengine

like image 89
Brandon Harris Avatar answered Jun 28 '26 16:06

Brandon Harris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!