Special char in url causes exception in daphne

46 views Asked by At

On my local and the staging system one URL works with the special character (umlaut) but on our production system an exception is thrown: "Invalid characters in path - daphne" (https://github.com/django/daphne/blob/993efe62ce9e9c1cd64c81b6ee7dfa7b819482c7/daphne/http_protocol.py#L100)

I use nginx as a reverse proxy in front of daphne.

The staging system, as it should be, is basically the same as the production system, same nginx config and same daphne arguments etc. But I guess missed something. I do not know where else to look. The setup is: Django -> Daphne -> nginx -> AWS (ECS) -> EC2 Load Balancer.

I checked both nginx configs and they are the same, except for the domain name.

Update:

Anonymized URL: https://app.****.com/api/****/abc-def-ab%C3%BCcdef

The complete error message is: `400 Bad Request

Invalid characters in path Daphne`

nginx log: **** - [03/Jan/2024:12:52:26 +0000] "GET /api/***/****%C3%BC**** HTTP/1.1" 400 442 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:121.0) Gecko/20100101 Firefox/121.0"

django/daphne log: 127.0.0.1:47596 - - [03/Jan/2024:12:52:26] "GET b'/****/****-****\xc3\xbc****'" 400 430

This is the working response from the staging system:

nginx: **** - [03/Jan/2024:12:56:22 +0000] "GET /****/****-%C3%BC**** HTTP/1.1" 200 269884 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:121.0) Gecko/20100101 Firefox/121.0"

django/daphne: 127.0.0.1:47376 - - [03/Jan/2024:12:56:53] "GET /****/****-%C3%BC****" 200 835470

And NOW I see a difference (production daphne \xc3\xbc vs staging daphne %C3%BC) - but why?

0

There are 0 answers