use nginx proxy_pass and rewrite to hide third party api credentials?
- by brakertech
Objective:
I'd like to have nginx hide calls to a third party api
Example Request:
http://example.com/myapi/60601
Nginx rewritten proxy_pass request calls:
http://api.remix.bestbuy.com/v1/stores(area(60601,10))?show=storeId,name&apiKey=redacted_24_character_string
Code i've tried:
This works but not for parameters
location ^~ /myapi/ {
rewrite ^/myapi/(.*) /api/check/$1/key/e95fad09aa5091b7734d1a268b53cef5 break;
proxy_pass http://api.server.com/;
}