openresty / openresty/lua-nginx-module
proxy_pass in Openresty
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 11.8k
- Forks
- 2.1k
- Avg merge
- 6h 1m
- Merged PRs (30d)
- 6
Description
I want to check something in Lua and then proxy_pass in my target using Nginx code but does not work!
location /nt {
default_type 'text/plain';
content_by_lua_block{
local res = ngx.location.capture("/download_server")
if res.status == ngx.HTTP_OK then
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
limit_req_status 444;
proxy_pass http://127.0.0.1:3000;
else
ngx.say('Failed to process, please try again in some minutes.')
end
}
}
location /download_server {
proxy_pass http://127.0.0.1:3000/nt;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by isolating the behavior of the /nt location and its content_by_lua_block, then compare it with the /download_server proxy_pass location. Capture the exact response and error output for both branches. Done means the configuration reliably proxies the target after a successful Lua check and returns the stated failure message otherwise.
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
- Needs clarification
- Newbie friendliness
- 20/100