我正在通過 Apache NiFi 傳遞性地使用 OkHttp。我正在嘗試確定如何在重定向時處理授權和其他敏感標頭。NiFi 的 InvokeHTTP 處理器與 OkHttp 在重定向方面的唯一交互是在這里,它讀取處理器屬性并在 OkHttpClientBuilder 對象上設置選項:// Set whether to follow redirects
okHttpClientBuilder.followRedirects(context.getProperty(PROP_FOLLOW_REDIRECTS).asBoolean());快速搜索 OkHttp 的來源,我似乎無法確定處理重定向的位置,以驗證Authorization從后續請求中刪除的內容,正如我所期望的。出于安全原因,cURL最近剛剛采用了這種行為。
1 回答

慕仙森
TA貢獻1827條經驗 獲得超8個贊
它發生在RetryAndFollowUpInterceptor 中。
// 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");
}
添加回答
舉報
0/150
提交
取消