openresty / openresty/stream-lua-nginx-module

nginx "content_by_lua_block" directive is not allowed here

Open
#333 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
749
Forks
210
Avg merge
4h 31m
Merged PRs (30d)
3

Description

nginx: [emerg] "content_by_lua_block" directive is not allowed here

stream {
    # define a TCP server listening on the port 1234:
    server {
        listen 1234;
        content_by_lua_block {
            ngx.say("Hello, Lua!")
        }
    }
}

nginx -v
nginx version: nginx/1.22.0

nginx -V
--prefix=/usr/local/nginx --with-pcre=../pcre-8.45 --with-zlib=../zlib-1.3 --with-openssl=../openssl-1.1.1q --pid-path=/data/logs/nginx/nginx.pid --error-log-path=/data/logs/nginx/error.log --http-log-path=/data/logs/nginx/access.log --lock-path=/var/run/nginx.lock --modules-path=/usr/local/nginx/modules --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --with-threads --with-http_sub_module --with-http_v2_module --with-http_auth_request_module --with-http_realip_module --with-http_secure_link_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_ssl_module --with-http_slice_module --with-http_stub_status_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail --with-mail_ssl_module --with-http_addition_module --with-http_random_index_module --with-compat --with-stream --with-file-aio --with-cc-opt='-Os -fomit-frame-pointer -g' --with-ld-opt=-Wl,-rpath,/usr/local/luajit/lib,--as-needed,-O1,--sort-common --add-module=/usr/local/src/ngx_devel_kit-0.3.1 --add-module=/usr/local/src/lua-nginx-module-0.10.21 --add-dynamic-module=/usr/local/src/echo-nginx-module-0.62 --add-dynamic-module=/usr/local/src/stream-lua-nginx-module-0.0.14rc1

when in http is ok

        location /lua {
            default_type 'text/plain';

            content_by_lua 'ngx.say("hello, lua")';
        }

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

Reproduce the reported stream configuration with nginx 1.22.0 and the listed lua-nginx-module and stream-lua-nginx-module versions, then compare it with the working http configuration. Trace how content_by_lua_block is registered and validated for stream servers; done means the intended stream configuration passes validation and has coverage for the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua, nginx
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.