use nginx proxy_pass and rewrite to hide third party api credentials?
        Posted  
        
            by 
                brakertech
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by brakertech
        
        
        
        Published on 2012-11-06T22:00:03Z
        Indexed on 
            2012/11/06
            23:03 UTC
        
        
        Read the original article
        Hit count: 385
        
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/;
}
        © Server Fault or respective owner