Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

142
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda