Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

133
Views
Apache proxy pass is redirecting instead of acting like a real proxy

I'm trying to hide the port of a deployed container and preserve the original url using ProxyPass. I've probably missconfigured something because instead of simply keeping the original address I get a redirect to the container address (example.com:8014 instead of keeping subdomain.example.com). The HTTP response is: 301 Moved Permanently (from service worker).

This is the virtual host containing the proxy:

<VirtualHost *:80>
        ServerName subdomain.example.com
        RewriteEngine on
        RewriteCond %{SERVER_NAME} =subdomain.example.com
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
        ServerAdmin admin@example.com
        ServerName subdomain.example.com
        ServerAlias subdomain.example.com

        LoadModule proxy_http_module modules/mod_proxy_http.so

        SSLProxyEngine On
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateFile /etc/letsencrypt/live/subdomain.example.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/subdomain.example.com/privkey.pem

        ProxyPreserveHost On
        ProxyPass / https://example.com:8014/
        ProxyPassReverse / https://example.com:8014/
</VirtualHost>

And this is the virtual host inside the container:

<VirtualHost *:80>
        ServerName example.com
        RewriteEngine on
        RewriteCond %{SERVER_NAME} =example.com:8014
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
        ServerAdmin admin@example.com
        ServerName example.com
        <Directory /var/www/html>
            AllowOverride All
        </Directory>
        SSLEngine On
        SSLProtocol             all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
        SSLCipherSuite          ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
        SSLHonorCipherOrder     off
        SSLSessionTickets       off
        SSLOptions +StrictRequire
        SSLCertificateFile /etc/apache2/fullchain.pem
        SSLCertificateKeyFile /etc/apache2/privkey.pem
</VirtualHost>

The container ports are mapped as follow: 80->8012, 443->8014.

My goal is to reach example.com:8014 using subdomain.example.com without changing the address. Also Im not even sure why when using example.com:8012 I'm not being redirected to https on port 8014. The issue must be in the container virtual host because it's it that is generating the 301 status code.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The configuration works just fine. I would advice clearing google chrome's cache when something like this happens.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!