s3api: preserve Host header port in signature verification (#8434)
Avoid stripping default ports (80/443) from the Host header in extractHostHeader. This fixes SignatureDoesNotMatch errors when SeaweedFS is accessed via a proxy (like Kong Ingress) that explicitly includes the port in the Host header or X-Forwarded-Host, which S3 clients sign. Also cleaned up unused variables and logic after refactoring.
This commit is contained in:
@@ -415,13 +415,13 @@ func TestSignatureV4WithoutProxy(t *testing.T) {
|
||||
name: "HTTP with standard port",
|
||||
host: "backend:80",
|
||||
proto: "http",
|
||||
expectedHost: "backend",
|
||||
expectedHost: "backend:80",
|
||||
},
|
||||
{
|
||||
name: "HTTPS with standard port",
|
||||
host: "backend:443",
|
||||
proto: "https",
|
||||
expectedHost: "backend",
|
||||
expectedHost: "backend:443",
|
||||
},
|
||||
{
|
||||
name: "HTTP without port",
|
||||
@@ -451,13 +451,13 @@ func TestSignatureV4WithoutProxy(t *testing.T) {
|
||||
name: "IPv6 HTTP with standard port",
|
||||
host: "[::1]:80",
|
||||
proto: "http",
|
||||
expectedHost: "::1",
|
||||
expectedHost: "[::1]:80",
|
||||
},
|
||||
{
|
||||
name: "IPv6 HTTPS with standard port",
|
||||
host: "[::1]:443",
|
||||
proto: "https",
|
||||
expectedHost: "::1",
|
||||
expectedHost: "[::1]:443",
|
||||
},
|
||||
{
|
||||
name: "IPv6 HTTP without port",
|
||||
|
||||
Reference in New Issue
Block a user