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

Privacy Center - 404s Logged as 200s #4186

Open
Tracked by #3570
RobertKeyser opened this issue Sep 28, 2023 · 2 comments
Open
Tracked by #3570

Privacy Center - 404s Logged as 200s #4186

RobertKeyser opened this issue Sep 28, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@RobertKeyser
Copy link
Contributor

RobertKeyser commented Sep 28, 2023

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 RobertKeyser added the bug Something isn't working label Sep 28, 2023
@RobertKeyser
Copy link
Contributor Author

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

@rsilvery
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants