Apache2 as reverse proxy not working?

Hello I am trying to setup apache2 as reverse proxy on Ubuntu.
For the backed I have tomcat 7.
For the configuration file /etc/apache2/sites-enabled/example.co.conf

<VirtualHost *:80>
        ServerName example.co
        ServerAlias *example.co
        ServerSignature Off

        RewriteEngine On
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

        ErrorLog /var/log/apache2/redirect.error.log
        LogLevel debug
</VirtualHost>


<VirtualHost *:443>
        ServerName example.co
        ServerAlias *example.co
        ProxyPreserveHost On
        ProxyRequests off
        AllowEncodedSlashes NoDecode

    <Proxy *>
          Order deny,allow
          Allow from all

    </Proxy>

        SSLEngine on
        SSLCertificateFile /etc/letsencrypt/live/example.co/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/example.co/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf

        ProxyPass / http://localhost:8080/ nocanon
        ProxyPassReverse / http://localhost:8080/

        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Port "443"

        LogLevel debug
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I tried to check using:

$elinks https://localhost 

and it’s works but when I tried from outside not working.

Any Help!

I noticed that I didn’t open 443 port on Amazon AWS. After I opened the port it’s work. this configuration works with me.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.