Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header normalization #117

Open
cdaguerre opened this issue Dec 12, 2024 · 2 comments
Open

Header normalization #117

cdaguerre opened this issue Dec 12, 2024 · 2 comments

Comments

@cdaguerre
Copy link

Hi, I'm looking for some guidance on Accept-Language and Accept-Encoding header normalization to avoid high cache key cardinality.

For encoding, I was thinking of something like:

map {header.Accept-Encoding} {accept} {
	~br      br
	~gzip    gzip
	default  *
}

request_header Accept-Encoding {accept}

And for Accept-Language I was looking at https://github.com/simia-tech/caddy-locale but it doesn't seem to work with caddy 2.

Do you have recommendations? Is this even necessary?

@darkweak
Copy link
Collaborator

Hello @cdaguerre that's something I would like to implement in the cache-handler/souin but I didn't find a way to do that without impacting the performances.

@cdaguerre
Copy link
Author

Hi @darkweak
If it helps, I wrote a locale normalization plugin for caddy 2 here: https://github.com/cdaguerre/caddy-locale

Using it with following config normalizes and overwrites the Accept-Language header.

locale en fr de {
  header Accept-Language 
}

But I have no clue of the performance impact...
And for encoding, I'm more or less using what I pasted in the issue description above.

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

No branches or pull requests

2 participants