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

Add uriencode featureflag to encode values set? #125

Open
erikbos opened this issue Feb 3, 2024 · 0 comments
Open

Add uriencode featureflag to encode values set? #125

erikbos opened this issue Feb 3, 2024 · 0 comments

Comments

@erikbos
Copy link

erikbos commented Feb 3, 2024

We're using the geoip2 module to do ip lookups from a Maxmind's database and insert this in requests going upstream.

Maxmind recently started introducing more non-ASCII contents in their dataset. See https://dev.maxmind.com/geoip/release-notes/2023#more-non-ascii-characters-in-english-place-names-in-geoip-products-and-services

The geo module takes Maxmind's data base values, UTF-8 strings, and inserts them as header(s) as configured. That works well in nginx but it can cause upstream issues: some web frameworks are strict about string encoding and do not like UTF-8 in an http header value.

An example: the value for Japanese city Ōbu gets encoded as string header value "C5 8C 62 75". In ISO8859 / Latin1 range 0x80 - 0x9F is not defined. Some web frameworks, or more likely the libraries they use to validate HTTP requests and strings, are strict about seeing an unspecified byte value (in this case 8C) and throw an error because of that :(

Is there any appetite to add a feature flag to encode string values set by the geoip module to prevent this? E.g. adding say geoip_string_uriencode on; to enable applying uriencoding to strings? (Any encoding that is ISO8859/latin1 "safe" would be ok..)

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

1 participant