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

124
Visualizações
Adding Apache basic auth to a headless backend and single page app frontend

I'm working on a project that I want to hide from the world behind Apache's basic auth whilst it's in development. The project has a PHP backend and a JS frontend on different virtual hosts. I have successfully setup basic auth on the backend and the JS application can make requests to it with the following configuration (123.456.789 being the JS application's IP address):

<Directory "/some/backend/folder">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All

        Order allow,deny
        allow from all

        AuthType Basic
        AuthName "Restricted Content"
        AuthUserFile /some/path/.htpasswd

        <RequireAny>
                Require valid-user
                Require ip 123.456.789
        </RequireAny>
</Directory>

The JS application's virtual host proxies requests to a Node server which ultimately handles any requests to the backend, using the following configuration:

ProxyPreserveHost On
ProxyRequests On
ProxyVia On

ProxyPass / http://0.0.0.0:3000/ connectiontimeout=600 timeout=600

I also want to add basic auth to this so that the world cannot access the frontend application. I've tried adding the following:

<Proxy *>
       Order deny,allow
       Allow from all
       AuthType Basic
       AuthName "Restricted Content"
       AuthUserFile /some/path/.htpasswd
       Require valid-user
</Proxy>

Which seemed to work at first, however all the previously working requests to the backend server now 401 which is rather confusing.

Does anybody know what's going on here? Does the act of adding basic auth to the proxy frontend virtual host screw-up the RequireAny config on the backend virtual host?

Any pointers greatly appreciated! Thanks

about 4 years ago · Santiago Gelvez
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