Skip to content

QUESTION: store POST message body to redis #51

@vkozubal

Description

@vkozubal

How can I write the nginx config to store the image to redis

curl -X POST localhost:80/upload/123 --data-binary "@lena.png"

I am trying to use $request_body but it doesn't work as I guess this variable value isn't available in this location.

location ~ /upload/(.*) { redis2_query set $1 $request_body; redis2_pass 172.17.0.4:6379; }
The expected result is to store the image binary data under the 123 key passed as query param.
Is there any way to do that?

UPDATE:
I used the https://github.com/klestoff/read-request-body-nginx-module read_request_body; directive. In this case, I am not able to send image bigger than client_body_buffer_size (default value is 16k) which is bad in if the image is bigger.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions