Apache http proxy setting for Cuba Platform application?

Cuba platform document provides the proxy setting for Nginx.

I have developed a tool using Cuba platform. The machine I am going to deploy has an Apache Http server installed. As there is some sites running, I can’t uninstall the Apache and install Nginx.

Does anyone know how the corresponding proxy setting in Apache?

I added the following lines to a virtual host, it doesn’t work.
######################
ProxyPass “/app” “http://localhost:8080/app
ProxyPassReverse “/app” “http://localhost:8080/app
######################

In the Cuba Platform’s document regarding the Nginx proxy setting, I can see that it needs quite a few other settings, but I don’t know how to do them in Apache Http server.

If you have ever configured in an Apache, could you help to give me some hints? Thanks.

Hello, I had the same problem. Reverse proxy and https under Apache.
First of all I’m following DigitalOcean procedure to install Tomcat.
Besides, to reverse proxy Apache I’m using mod_proxy, not mod_jk because of the many issues I found.
Here’s an uncommented tamplate from my 000-default.conf file (rewrite rules apply for https):

<VirtualHost *:80>

    ServerAdmin your.mail@email.com
    ServerName yourwebsite.com
    ServerAlias www.yourwebsite.com
    DocumentRoot /opt/tomcat/webapps/ROOT

    ProxyPreserveHost On

    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse / http://127.0.0.1:8080/

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.yourwebsite.com [OR]
    RewriteCond %{SERVER_NAME} =yourwebsite.com
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

</VirtualHost>
1 Like

Thanks @lucio.rossi75. Below are the actual settings working for me.

OS: CentOS Linux release 7.8.2003 (Core)
Apache Http server: 2.4.6

Create a file called cuba-platform.conf in /etc/httpd/conf.d/ folder as follows.

<VirtualHost *:80>
  ServerName #IP or Domain#
  ServerAdmin #You email address#

  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}/app/$1

</VirtualHost>

<VirtualHost *:443>
  ServerName #IP or Domain#
  ServerAdmin #You email address#

  SSLEngine on
  SSLCertificateFile #path to public ssl certification file#
  SSLCertificateKeyFile #path to ssl certification's private key file#
  SSLCACertificateFile #path to ssl certification's CA file file#

  ProxyRequests Off

  RemoteIPHeader X-Forwarded-For
  RemoteIPHeader X-Real-IP
  RemoteIPHeader X-Client-IP
  RemoteIPInternalProxy #IP#

  ProxyAddHeaders On

  <Proxy http://localhost:8080>
        Order deny,allow
        Allow from all
  </Proxy>

  <Location /app/ >
        ProxyPass http://localhost:8080/app/
        ProxyPassReverse http://localhost:8080/app/
  </Location>

</VirtualHost>
1 Like