• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question How does location and proxy_pass work?

MartinH

New Pleskian
Hi,

for basic testing I have set up a simple node server listening on port 5100 and a nginx directive
Code:
location /api/ {
    proxy_pass http://127.0.0.1:5100/api/;
}

I am pretty new at this, but doesn't this directive mean, that a request like
Code:
https://myserver.com/api/xxxx
will be redirected to
Code:
http://127.0.0.1:5100/api/xxxx
I get an empty 200 response (was expecting a simple string).

A request to
Code:
location /api/ {
    proxy_pass http://127.0.0.1:5100/;
}
is working fine, but is not routed to /api/xxxx like I want it to.

What am I doing wrong? Thanks
 
Back
Top