fides icon indicating copy to clipboard operation
fides copied to clipboard

Privacy Center - 404s Logged as 200s

Open RobertKeyser opened this issue 2 years ago • 2 comments

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.

image image

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

  1. Browse to your favorite privacy center
  2. Enter any path that the server should return with a 404
  3. Receive 404
  4. 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.x and 2.20.x
  • OS:
  • Python Version:
  • Docker Version:

Additional context

Showing 200s in the logs makes it harder to detect unusual behavior.

RobertKeyser avatar Sep 28 '23 18:09 RobertKeyser

This seems to be related to the fact that NextResponse.Next()'s status attribute is apparently always a 200

RobertKeyser avatar Sep 28 '23 20:09 RobertKeyser

https://ethyca.atlassian.net/browse/PROD-1221

rsilvery avatar Oct 20 '23 14:10 rsilvery