module which handles POST request help

Ben Mesander bmesander at
Mon Sep 18 15:27:36 UTC 2023

I'm working on an nginx module which will handle POST requests. I've never
written an nginx module before, but I have worked on apache modules. My
goal is to have it do unbuffered reads and process the data being posted as
it arrives. Initially, I'm doing just a simple blocking read of the POST
body. I've simplified things down almost to the "hello world" level.

When I do a POST, my module gets called, but I get a 404 not found, I am
not sure why. I do see the file I post being uploaded and stored in a file
in the nginx temporary file area. I do not see an entry in the access log
showing the POST, again I am not sure why.  How can I fix these things?

Source to my module:

Results of sending a POST request:

bmesander at o-bmesander-D093Y Downloads % curl -v -X POST -H "Content-Type:
application/json" -d @chrome-net-export-log.json http://www:80/upload

Note: Unnecessary use of -X or --request, POST is already inferred.

*   Trying x.x.x.x:80...

* Connected to www (x.x.x.x) port 80 (#0)

> POST /upload HTTP/1.1

> Host: www

> User-Agent: curl/7.86.0

> Accept: */*

> Content-Type: application/json

> Content-Length: 777095


* We are completely uploaded and fine

* Mark bundle as not supporting multiuse

< HTTP/1.1 404 Not Found

< Server: nginx/1.25.3

< Date: Mon, 18 Sep 2023 15:11:35 GMT

< Content-Type: text/html

< Content-Length: 153

< Connection: keep-alive



<head><title>404 Not Found</title></head>


<center><h1>404 Not Found</h1></center>




* Connection #0 to host www left intact

Here is how I am building nginx & my module:

auto/configure --with-debug --with-cc-opt="-fsanitize=address
-DNGX_DEBUG_PALLOC=1" --with-ld-opt="-fsanitize=address" --add-module=../

Thank you,


*Ben Mesander       **C**ARDINAL**P**EAK*

(303) 570-1606  |   Email <bmesander at>  |  Web
<> |  Company Blog
<>  |  LinkedIn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list