问题
If I have configured a property Authorization
with a bearer token, will InvokeHTTP send that header to the redirected URL?
I can't find anything in the documentation about it. I also can't seem to find clarity in the source of OkHttp, the underlying library for InvokeHTTP.
Is there a way to strip a header from a redirected URL based on the URL?
I may quickly be getting into "use ExecuteGroovyScript" territory here.
回答1:
The short answer is no, because OkHttp strips Authorization on redirects:
// When redirecting across hosts, drop all authentication headers. This
// is potentially annoying to the application layer since they have no
// way to retain them.
if (!sameConnection(userResponse, url)) {
requestBuilder.removeHeader("Authorization");
}
We know this thanks to https://stackoverflow.com/a/52285990/204052.
来源:https://stackoverflow.com/questions/52284452/do-apache-nifis-invokehttp-and-other-http-processors-send-an-authorization-head