-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
How to Add UNIQUE_ID to Response Headers? #3290
Comments
Hi @meguoe, have you seen our issue templates? Both (for v2 and v3) has this section:
Please fill this block at least. Without that we don't know if it's possible or not. |
Sorry, my information is as follows: |
Hi @meguoe, thanks. Unfortunately that's not possible what you want with Nginx + libmodsecurity3. Actually the connector is not able to read variables from the library and pass them to the web server. |
Is there any way to achieve this? I need to display an error page with a unique request ID to the user upon rejection, as this is essential for subsequent analysis and troubleshooting. Any insights on how to implement this with libmodsecurity3 would be greatly appreciated. Thank you! |
Also, can I ask if libmodsecurity2 can do it? |
Hi @airween , I already have a solution, using $request_id directly can meet my needs.
|
hi @meguoe, thanks for sharing your solution! |
hi @airween , My solution seems to have some issues; during phase:1 blocked, response.headers is empty. Do you have a better solution? My ultimate goal is to add $request_id to the audit log. |
Another question, when phase:1 triggers interception, two identical audit logs are always generated. What is the reason? I think nginx triggered the rule repeatedly after internal redirection. How to deal with this?
|
How looks your rule like? Could you show us? |
I also tested other strategies in phase:1, which always produced 2 identical audit logs, but this situation only occurred when using a custom error page, that is, during internal redirection. |
If possible, could you prioritize looking into how to add $request_id to the audit log? |
I want to know how to add the UNIQUE_ID response header, as it is important for tracking and debugging requests.
The text was updated successfully, but these errors were encountered: