Skip to content

Instantly share code, notes, and snippets.

@berndverst
Created January 25, 2018 01:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save berndverst/37d87570418bbee77641777e13bc10c9 to your computer and use it in GitHub Desktop.
Save berndverst/37d87570418bbee77641777e13bc10c9 to your computer and use it in GitHub Desktop.
API Proxy to hide API Credentials based on Azure Functions Proxy
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"API proxy with Credentials": {
"matchCondition": {
"route": "/api/{*route}",
"methods": [
"GET"
]
},
"backendUri": "https://readon.ly/{route}",
"requestOverrides": {
"backend.request.method": "get",
"backend.request.querystring.client_id": "XXXXXXXXX",
"backend.request.querystring.client_secret": "ZZZZZZZZZ"
}
}
}
}
@berndverst
Copy link
Author

Or create this via the Azure Portal:
image

@berndverst
Copy link
Author

This provides a simple way to proxy API requests via your domain to a third party API while keeping your API credentials hidden. This approach is also highly performant and cost effective thanks to the serverless approach.

Simply update the Backend URL with your desired destination API. Update the request params for authentication or add the necessary header override.

@berndverst
Copy link
Author

berndverst commented Jan 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment