openresty / openresty/echo-nginx-module

Missing request body despite echo_read_request_body use

Open
#117 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1.2k
Forks
251
Avg merge
1h 24m
Merged PRs (30d)
2

Description

I'm using the echo modules to send the same GitHub webhook request to two backends that needs to receive it. I spit them using echo_subrequest_async, but when I do there is no request body. I have tried using both -b $request_body and -f $request_body_file with the same effect:

location = /webhook {
  echo_read_request_body;
  echo_subrequest_async POST /webhook_backend_0 -f $request_body_file;
  echo_subrequest_async POST /webhook_backend_1 -f $request_body_file;
}
location = /webhook_backend_0 {
  proxy_pass http://10.10.0.10:8080/webhook;
}
location = /webhook_backend_1 {
  proxy_pass http://10.10.0.20:8080/webhook;
}

When using -f $request_body_file I managed to catch this in Nginx errors:

open() "/var/lib/nginx/body/0000005084" failed (2: No such file or directory), client: 1.2.3.4, server: example.org, request: "POST /webhook HTTP/1.1", host: "example.org"

Which indicates that the request body is indeed missing, but as far as I know it is not, since GitHub does send it.

This suggests a bug in the echo module.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the example configuration using echo_read_request_body, echo_subrequest_async, and $request_body_file, then reproduce the missing-body behavior and the reported Nginx open() error. Trace how the request body is handled for both asynchronous subrequests; done means both webhook backends receive the original body without the missing-file error.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, nginx
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.