0

I currently have a bitnami LAMP stack running hosting my website at www.uktransportprofiles.co.uk and I have a nodejs instance running at www.uktransportprofiles.co.uk:7200. However I want to proxy pass this so that the api can be found at www.uktransportpfoiles.co.uk/api and for that to also have the ssl certificate as well.

I have tried adding

SSLProxyEngine on

ProxyPass /api http://localhost:7200
ProxyPassReverse /api http://localhost:7200

To

/opt/bitnami/apache2/conf/bitnami/bitnami.conf 
&
/opt/bitnami/apache2/conf/bitnami/bitnami-ssl.conf

But this hasn't worked. Any ideas and advice would be appreciated

Philip09
  • 85
  • 9

1 Answers1

1

Bitnami developer here!

At the end of the day, you have an Apache server listening for incoming connections on two ports (80 and 443) and you want to forward some of them to another backend server depending on the URI.

As you pointed out, this can be achieved with ProxyPass and the proxy features built-in Apache. You can check out the original documentation for further reference.

https://httpd.apache.org/docs/2.4/mod/mod_proxy.html

Bitnami's LAMP separates each Apache VirtualHost (80 and 443) config in two files, bitnami.conf and bitnami-ssl.conf. If you only want your users to access the API through SSL, you'll only need to modify bitnami-ssl.conf. Additionally, I suppose you want to stick to the same SSL certificate your main domain is using, so you should skip the SSLProxyEngine directive.

As an alternative to your proposed changes, you can append the following to the bitnami-ssl.conf VirtualHost to proxypass some request depending on the sub-URI.

<VirtualHost _default_:443>
...
  <Location "/example">
    ProxyPass "http://example.com/"
    ProxyPassReverse "http://example.com/"
  </Location>
..
</VirtualHost>

After performing the changes, you need to make sure to restart Apache:

$ sudo /opt/bitnami/ctlscript.sh restart apache

You can check that the output is the same when using the proxypass and directly querying the upstream:

$ curl -k --silent https://34.XXX.XXX.XXX/example -o out.html && curl --silent https://example.com -o out2.html && diff <(md5sum out.html | awk '{ print $1 }') <(md5sum out2.html | awk '{ print $1 }')

Regards,

Jose Antonio Carmona