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

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

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 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