Apache NiFi 的 InvokeHTTP 和其他 HTTP 处理器是否向重定向的 URL 发送授权标头? [英] Do Apache NiFi's InvokeHTTP and other HTTP processors send an Authorization header to redirected URLs?
问题描述
如果我已使用承载令牌配置了属性 Authorization
,InvokeHTTP 会将该标头发送到 重定向的 URL 吗?
If I have configured a property Authorization
with a bearer token, will InvokeHTTP send that header to the redirected URL?
我在文档中找不到任何关于它的内容.我似乎也无法在 InvokeHTTP 的底层库 OkHttp 的源代码中找到清晰的信息.
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.
有没有办法根据 URL 从重定向的 URL 中剥离标头?
Is there a way to strip a header from a redirected URL based on the URL?
我可能很快就会进入使用 ExecuteGroovyScript"领域.
I may quickly be getting into "use ExecuteGroovyScript" territory here.
推荐答案
简短的回答是否定的,因为 OkHttp 在重定向时去除Authorization
:
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");
}
我们知道这要归功于 https://stackoverflow.com/a/52285990/204052.
We know this thanks to https://stackoverflow.com/a/52285990/204052.
这篇关于Apache NiFi 的 InvokeHTTP 和其他 HTTP 处理器是否向重定向的 URL 发送授权标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!