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

Capture the request body #64

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Bibop182
Copy link

This PR makes the following changes

  • (new feature) The ngx_postgres module do not discard request body anymore. The request body is captured and can be used in requests.
  • The request body is processed to escape string literals before substitution.

Description

Now nginx will read the entire request body in the content step if the postgres_query directive was used. '$request_body' variable can now be used in sql query string.

The variable request_body cannot be processed by the postgres_escape directive during the rewrite phase. Therefore, for security reasons, the request_body value that is used in postgres_query is always processing to escape string literals during the content phase without the need for postgres_escape.

This behavior can be disabled by directive postgres_escape_request_body off.

Added tests to check behavior when using the request body. Added a configuration sample in the readme.

Changes for supporting current versions of nginx (fixes #57) included.

@Bibop182 Bibop182 changed the title Capture request body Capture the request body Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compilation error on nginx > 1.10
1 participant