openresty / openresty/openresty

ngx.location.capture error : unsafe byte "0x9" in header

Open
#618 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
14k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

openresty version:1.15.8.3
example code:

access_by_lua_block {
local res = ngx.location.capture('/secureCheck',
                    {
                        method = method,
                        body = args.data,
                        copy_all_vars = true,
                        always_forward_body = true,
                        share_all_vars = true
                    }
                )
}

full error:

access_by_lua(nginx.conf:223):15: in main chunk, client: 100.121.135.117, server: , request: "GET xxxxxxxxxx HTTP/1.1", host: "******", referrer: "*****"
2020/05/28 10:49:13 [error] 31820#0: *6897729 unsafe byte "0x9" in header "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) \x09\x09\x09Chrome/55.0.2883.95 Safari/537.36", client: 100.121.135.66, server: , request: "GET xxxxx HTTP/1.1", host: "xxxxx", referrer: "blank"
2020/05/28 10:49:13 [error] 31820#0: *6897729 lua entry thread aborted: runtime error: access_by_lua(nginx.conf:223):15: failed to adjust the subrequest: -1
stack traceback:
coroutine 0:
 [C]: in function 'capture'
 access_by_lua(nginx.conf:223):15: in main chunk, client: 100.121.135.66, server: , request: "GET xxxxxxxx HTTP/1.1", host: "xxxxxxx", referrer: "blank"

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 at the access_by_lua_block in nginx.conf:223 and inspect the ngx.location.capture call using the reported OpenResty 1.15.8.3 configuration. Reproduce the failure with the request whose user-agent contains 0x9, then trace the unsafe-header error and failed subrequest; done should be defined as establishing the expected handling and preventing the reported abort.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.