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

[Question] How to log #175

Closed
1 task done
arlando opened this issue Feb 7, 2024 · 1 comment
Closed
1 task done

[Question] How to log #175

arlando opened this issue Feb 7, 2024 · 1 comment
Labels

Comments

@arlando
Copy link

arlando commented Feb 7, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

We have experienced random 403s on our app and I'm trying to find the root cause. I think the source is go/csrf due to expired cookies, but haven't yet confirmed this. I am using logrus to log completed requests in chi via middleware. If there is a CSRF issue, I would like to add the reasoning to the log something like ... go.csrf.error='csrf expired' ....

I am having some difficulty getting this to work in a test environment. I think here the request context is cleared. So, in my request completed logrus hook doesn't see the CSRF 403 information in the request context.

I know the CSRF rejection reasoning is being provided back to the client via text, but this use case is an app that is doing background updates. The client doesn't see the reasoning error. Also, it might not be best practice to expose this information to the client. The only other solution I can think of is to make a custom HTTP error handler but I am trying to avoid this. Any advice here?

Expected Behavior

No response

Steps To Reproduce

No response

Anything else?

No response

@arlando arlando added the bug label Feb 7, 2024
@arlando
Copy link
Author

arlando commented Feb 7, 2024

Gonna close just going to use a custom handler.

@arlando arlando closed this as completed Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant