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

397
Visualizações
Node.JS + Apache - Cannot GET

I'm trying to use Apache and Node.JS at the same time but it is not working as expected.

// Apache 
  ProxyPreserveHost On
  ProxyRequests Off
  ServerName mydomain.com
  ProxyPass / http://localhost:3000/
  ProxyPassReverse / http://localhost:3000/

And for my server.js

// Node
  const express = require ('express');
  const server = express();

  server.get('/', function(req,res){
    return res.send('The code works fine here');
  });

  server.get('/foo', function(req,res){
    return res.send('Here => Cannot GET /foo');
  });

  server.get('/foo2', function(req,res){
    return res.send('Here too => Cannot GET /foo2');
  });

  server.listen(3000, function() {
    console.log('server is only working for "/" ')
  });

mydomain.com works perfectly, but I cannot find a way to make all the other sub-domains mydomain.com/* to work. Can someone give me a light?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You can use Apache reverse proxy

Add this configuration to your apache conf.

ProxyPass "/nodeapp" "http:/localhost:8443"

You can access node application by http://www.example.com/nodeapp

A reverse proxy is a type of proxy server that retrieves resources on behalf of a client from the server. These resources are then returned to the client as if they originated from the web server itself.

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