openresty / openresty/lua-nginx-module

content_by_lua and access_by_lua not executing in mirror block

Open
#1,803 2 comments 1 reaction 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,

I'm having trouble running either content_by_lua_block or access_by_lua_block inside a mirror block.

This is my configuration

server {
	listen       8888;
	server_name *;
	proxy_connect;
	proxy_max_temp_file_size 0;
	resolver 8.8.8.8;
	
	location / {		
		mirror /mirror;

		access_by_lua_block {
			ngx.log(ngx.ERR, "Hello world 1")
		}
		
		proxy_pass http://127.0.0.1:8080;	
	}

	location /mirror {

		access_by_lua_block {
			ngx.log(ngx.ERR, "Hello world 2")
		}

		proxy_pass http://127.0.0.1:8090$request_uri;

                internal;
	}	
}

In my error.log file I can see the text "Hello world 1", but not "Hello world 2". I know that the /mirror block is being accessed correctly because I'm monitoring it with Wireshark.

Please let me know if you need any more information.

Versions:
OpenResty 1.17.8.2
nx_lua 0.10.17

Dump of openresty -V

nginx version: openresty/1.17.8.2
built by gcc 9.3.0 (Alpine 9.3.0)
built with OpenSSL 1.1.1g  21 Apr 2020
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.17 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.15 --add-module=../rds-csv-nginx-module-0.09 --add-module=../ngx_stream_lua-0.0.8 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --add-module=/usr/src/chobits-ngx_http_proxy_connect_module-96ae4e0 --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_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

No source file or test is named. Reproduce the supplied mirror configuration with OpenResty 1.17.8.2 and ngx_lua 0.10.17, then trace how the /mirror subrequest reaches the Lua access and content handlers. Done should establish the expected behavior for both blocks and cover it with a regression test.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.