API Proxy sends your request to the external application without changes and returns the exact response the external app provided. The API proxy does three things with your requests:
- Prepends the base URL to the path you provide (unless you provide a full URL)
- Adds authentication headers to the request
- Handles credential refreshes automatically
Using API Proxy
REST API
To make a Proxy request using REST API, simply prefix the request with- Integration key (if there is only one connection for the integration)
- Integration ID (if there is only one connection for the integration)
- Connection ID
JavaScript SDK
To make a Proxy request using JavaScript SDK, useproxy property of the Connection:
.get, .post, .patch, .put and .delete requests of the proxy property.First parameter is an API path and the second is an optional object with the request payload for
post, patch, and put methods.
Edge Cases
Headers
There are special headers that are used by the proxy infrastructure. They will be ignored by the proxy and not passed to the underlying application. Here is the full list of these headers:- host
- x-request-id
- x-real-ip
- x-forwarded-for
- x-forwarded-host
- x-forwarded-port
- x-forwarded-proto
- x-forwarded-scheme
- x-scheme
- x-original-forwarded-for
- x-different-name
- x-request-start
- x-using-nginx-controller
- x-amzn-trace-id
- forwarded-for-header
- proxy-protocol
- real_ip_header
- real_ip_recursive
- cdn-loop
- cf-ipcountry
- cf-ray
- cf-visitor
- cf-connecting-ip
- connection
- authorization
- content-length
Error Handling
Proxy will return the same status code, headers, and body that the underlying application’s API returns. The only exception is handling credential refreshes. If proxy receives a response indicating that the credentials have expired, it will attempt to refresh the credentials once. Here are the possible outcomes when this happens:- If refresh is successful – it will retry the request and return the second response (successful or not).
- If refresh process fails – it will return a Membrane error with details and the log of API requests to external app that led to the error.