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

216
Vistas
nginx forward request with the same domain

I'm not an expert on networking or servers but I need to configure Nginx server, this server will listen two different external addresses:

  1. https://fake.net
  2. https://example.com

I have a Node.js application locally in this server deployed in: http://localhost:3020

I'm trying to proxy from nginx to the Node.js app but, the thing is that I need the Node.js api to received the request with the original url request.

Is there any way to forward the request in this way:

Request: https://fake.net/api/test -------> In the Node app received: http://fake.net/api/test

Request: https://example.com/api/test1 -------> In the Node app received: http://example.net/api/test1

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The Host header defines the domain part of the proxied request. Generally $host is used to get the value from the original request. See this document for details.

The request is passed transparently if no optional URI is provided to the proxy_pass directive. See this document for details.

For example:

location /api/ {
    proxy_set_header Host $host;
    proxy_pass http://localhost:3020;
}
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