Score:1

Nginx proxy pass regex

us flag

I'm trying to configure nginx as a reverse proxy while using regex at the same time. I want this URI on my server: www.mydomain.com/dealers/in/evansville/11487/

To proxy this to the remote server: locations.where2getit.com/mydomain/in/evansville/11487/

When I use the location rule below, I'm getting a 502 error:

location ~* (.*dealers)/(.*)/(.*)/(.*)/$ {
    proxy_pass https://locations.where2getit.com/mydomain/$2/$3/$4/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Port $server_port;
}

Any tips to get this working properly?

Michael Hampton avatar
cz flag
Check the nginx error log.
Gray Loon avatar
us flag
All I have is: ```2021/07/16 11:07:34 [notice] 608950#608950: signal process started 2021/07/16 11:07:46 [notice] 609223#609223: signal process started```
Gray Loon avatar
us flag
Adding a resolver and stripping down some of headers seems to be an improvement. ```location ~* (.*dealers)/(.*)/(.*)/(.*)/$ { resolver 8.8.8.8; proxy_pass https://locations.where2getit.com/mydomain/$2/$3/$4; proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; }```
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.