Privacy Center - 404s Logged as 200s
Bug Description
When the Privacy Center encounters a bad URL, e.g. https://[privacy-center]/bad-url, it's returns a 404 to the client.
However, on the server, the HTTP request is logged as a 200
{"method":"GET","status_code":200,"handler_time":"0ms","path":"/bad-url"}
Steps to Reproduce
- Browse to your favorite privacy center
- Enter any path that the server should return with a
404 - Receive
404 - Check logs and see
200
Expected behavior
Logging should match reality.
The server should only log a 200 if the HTTP response to the client is actually a 200.
If the server responds with a 404, the server logs should log a 404.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
- Version: Checked on
2.19.xand2.20.x - OS:
- Python Version:
- Docker Version:
Additional context
Showing 200s in the logs makes it harder to detect unusual behavior.
This seems to be related to the fact that NextResponse.Next()'s status attribute is apparently always a 200
https://ethyca.atlassian.net/browse/PROD-1221