[edge] Fixes: skip 1xx, enforce auth timeout, resolve upstreams per connect, all Upgrade tokens, strip Remote-*
This commit is contained in:
@@ -19,10 +19,10 @@ use std::time::Duration;
|
||||
|
||||
use bytes::Bytes;
|
||||
use http::header::{self, HeaderName, HeaderValue};
|
||||
use pingora::Result;
|
||||
use pingora::connectors::http::Connector;
|
||||
use pingora::http::{RequestHeader, ResponseHeader};
|
||||
use pingora::proxy::Session;
|
||||
use pingora::{Error, ErrorType, Result};
|
||||
|
||||
use crate::fetch::fetch;
|
||||
use crate::runtime::ForwardAuthRt;
|
||||
@@ -82,6 +82,13 @@ pub async fn check(
|
||||
|
||||
let got = fetch(connector, &fa.upstream, sub, MAX_AUTH_BODY, AUTH_TIMEOUT).await?;
|
||||
let status = got.header.status.as_u16();
|
||||
if status < 200 {
|
||||
// 101 (or any 1xx left over) is not an answer we can pass on or treat as an allow.
|
||||
return Error::e_explain(
|
||||
ErrorType::InvalidHTTPHeader,
|
||||
format!("auth server answered {status}"),
|
||||
);
|
||||
}
|
||||
if (200..300).contains(&status) {
|
||||
let copy = fa
|
||||
.copy_headers
|
||||
|
||||
Reference in New Issue
Block a user