-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Force to send custom headers back to the client and fix POST 500 error #826
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
Force to send custom headers back to the client and fix POST 500 error #826
Conversation
Refactoring on the nginx module, including: - Better handling larger posts; - Now using nginx echo module during the regression tests. - Better interacting with neginx chain rules - Separation of the request handling and content filters. - Better handling nginx sessions and resource counts to allow a more efficient garbage collector. - Handling both http/1.0 and 1.1, including keep-alive. - Tests are now capable to test nginx as a proxy or end-server. - Tested agains nginx 1.6 and 1.7.
If nginx segfaults it will return, warning that the test failed.
Add a check for the definition MOVE_REQUEST_CHAIN_TO_MODSEC, whenever it is set the chain will be moved into the brigade. If it was not set the chain will be only copied. Moving was causing segfaults on the following regression tests: owasp-modsecurity#15 - SecRequestBodyInMemoryLimit owasp-modsecurity#16 - SecRequestBodyInMemoryLimit (greater) owasp-modsecurity#19 - SecRequestBodyLimitAction ProcessPartial (multipart/greater - chunked) (from: regression/config/10-request-directives.t)
Otherwise nginx's installation directory could not be specified. Signed-off-by: paulyang <[email protected]>
This eliminates segfaults caused by unset (NULL) r->port_start and non-NULL r->port_end. In fact, r->port_start is always NULL, so it is useless to rely on this pointer.
33b8760
to
ed4a4d2
Compare
I was getting 500 errors on POST and this fixed the problem. If there was a +1 button I would push it. |
Yes this patch solves 500 and x headers issues.
|
I can confirm that this resolved the POST 500 error. Thanks! |
c2e4e03
to
1f1eea3
Compare
Hi @ton31337 the current version of our nginx_refactoring branch returns all the headers to the users, including those "X-Flash-Message", can you confirm that it is working for you? |
It misses new_h->hash = 1; And we are getting 500 POST with SecRequestBodyAccess On. Need the last On Tue, Mar 24, 2015 at 10:39 PM, Felipe Zimmerle [email protected]
Donatas |
Not sure if I am looking to the right commit. I am looking to this one: The content is: Is that correct? If so, the blocks A, B, C, E, F and G will no longer be necessary as we are saving all the headers already. Only left the block "D" (also covered by #740) and the problem that you have mentioned about "new_h->hash = 1;". Do you mind to share the scenario of the crash, it will be valuable. I can place it under our regression tests. |
Using @ton31337 branch for the XHeaders PR has resolved the 500 errors we were getting. Even a simple wp-login.php POST was the error. Will it be merged soon ? |
@zimmerle I don't have now any chance to make you crash test, because I don't work for that company they are using ModSecurity, sorry. |
|
2c95bcd
to
8a49998
Compare
@zimmerle should I rebase my branch or can I delete it at all (suppose you don't use it)? |
Hi @ton31337, keep it here. It is used as a reference in too many issues now. I am working on libmodsecurity - Expecting to solve all those bugs with this new version of ModSecurity. |
@zimmerle you should pay more attention on POST 500 error. Take a look at this line: ton31337@2bb9c00#diff-a80339e1bd9e20765a4f9539ae3c09ecR547 (if you debug POST 500 with gdb you will see that sometimes header names come with some trashes - without new line character) and about sending headers from back-end to browser there is missing ton31337@2bb9c00#diff-a80339e1bd9e20765a4f9539ae3c09ecR851. |
0751293
to
582808a
Compare
f4caddc
to
169e918
Compare
Hi @ton31337, I would like to thank you again for the patches. I am closing this issue as pieces of your merge request was already merged into the nginx_refactoring branch. Thank you. |
Custom headers are skipped when using nginx as proxy_pass to origin. They are displayed only in audit_log, but the client doesn't see them. For example X-Flash-Message header.