openresty / openresty/lua-nginx-module

content_by_lua_block ignored if fastcgi_pass statement is used

Open
#2,142 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.8k
Forks
2.1k
Avg merge
6h 1m
Merged PRs (30d)
6

Description

Hello,

Lua is not invoked when fastcgi_pass is used.

location / {
  content_by_lua_block {
    ngx.log(ngx.ERR, "HELLO")
    ngx.exit(ngx.HTTP_FORBIDDEN)
    }
  fastcgi_pass  unix:/dev/shm/master/fcgiwrap.socket;
}

Commenting the 'fastcgi_pass' line and it all works as expected (I see "HELLO" in the logs). But with fastcgi_pass statement the lua-block is not evaluated at all. In fact it's possible to have illegal LUA statements inside the lua_block and nginx wont even complain about them being illegal.

I came to this while trying to process some FORM POST data before passing them on via fastcgi_pass.

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 by reproducing the shown location configuration with content_by_lua_block and fastcgi_pass, then trace the module entry points handling those directives. Confirm whether the Lua block is skipped during FastCGI processing; done means valid Lua is evaluated and can log or reject the request before FastCGI handling.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.