Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!