Skip to content

Conversation

@mkrou
Copy link

@mkrou mkrou commented Aug 1, 2025

…s is empty

When CORS origins configuration is empty, disable CORS headers to avoid conflicts with proxied server's CORS headers. This prevents duplicate Access-Control-Allow-Origin headers when killgrave is used as a proxy.

  • Add AllowedOriginValidator that returns false when origins is empty
  • Add comprehensive tests for PrepareAccessControl function
  • Maintain backward compatibility for non-empty origins configuration

Fixes issue where empty origins list would cause gorilla/handlers to add default '*' origin header, conflicting with proxied server headers.

mkrou added 2 commits August 1, 2025 16:13
…s is empty

When CORS origins configuration is empty, disable CORS headers to avoid
conflicts with proxied server's CORS headers. This prevents duplicate
Access-Control-Allow-Origin headers when killgrave is used as a proxy.

- Add AllowedOriginValidator that returns false when origins is empty
- Add comprehensive tests for PrepareAccessControl function
- Maintain backward compatibility for non-empty origins configuration

Fixes issue where empty origins list would cause gorilla/handlers to add
default '*' origin header, conflicting with proxied server headers.
@joanlopez
Copy link
Member

Hi @mkrou,

Thanks for your contribution! 🙌🏻

Could you please split this PR into two, separating the Dockerfile addition?
Also, I'd appreciate if in the one specific for the new Dockerfile, you can detail why it's needed, etc.

}
}

func TestPrepareAccessControl(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to this, could you please write an "integration" test to make sure Killgrave behaves as expected? I'd also help understanding why we need it.

Thanks! 🙇🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants