Keep authorization headers on redirect #35058
dmvianna
started this conversation in
Connector Ideas and Features
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Many SaaS vendors provide REST APIs behind URLs that redirect traffic. Dayforce and MYOB are examples. This presents a problem for Airbyte users: Airbyte relies on the Python library requests as a HTTP handler, and requests, on receiving a HTTP 302 redirect code will issue another HTTP request to the new target URL without the Authentication headers. This will invariably result in a HTTP 401 Unauthorized response in these platforms.
The requests core developers chose this behaviour in response to a security vulnerability, which is understandable from their point of view. However this prevents users of the above vendors from using the Airbyte platform to communicate with them.
I would like to request Airbyte to add a feature where an user could optionally keep the authorization headers on redirect. This is the approach both curl and postman have adopted.
Below some runnable code illustrating the problem on the public Dayforce platform:
dayforce_redirect.sh
This will demonstrate a
HTTP 302 Redirect
follow byHTTP 401 Unauthorized
, with no payload. That's what Airbyte currently does. Now, if we replace--location
in the second request with--location-trusted
,then we should get a
HTTP 302 Redirect
followed byHTTP 200 OK
with some JSON payload.How to fix that in requests?
dayforce_redirect.py
This is of course a minimum example. But it illustrates that it is possible to just subclass
Session
and even explicitly refer to what domains we are happy to be redirected. I of course defer to Airbyte developers for implementation.Beta Was this translation helpful? Give feedback.
All reactions