TechRex
TechRex

Reputation: 43

How to make nginx proxy according to url parameters?

I want to make nginx proxy according to url parameters

url example: www.foo.com/proxy/$serverUrl/$picUrl

$serverUrl example: storage.example.com $picUrl example: test.jpg or test.png

proxy to: https://$serverUrl/static/$picUrl

how to make nginx proxy like that?

Upvotes: 1

Views: 160

Answers (1)

tyloafer
tyloafer

Reputation: 133

location ~ /proxy/(.*)/(.*)$ {
    proxy_pass https://$1/static/$2;
}

try it, hope it would be helpful

Upvotes: 1

Related Questions