Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

390
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda