openresty / openresty/lua-nginx-module
How to close tcp connection by lua when use OR proxy websocket?
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 11.8k
- Forks
- 2.1k
- Avg merge
- 6h 1m
- Merged PRs (30d)
- 6
Description
As shown below,I used OR to proxy websocket, after switching protocol, the http request finished and websocket continued with the tcp connection. But how can I close the tcp connection actively by lua when I received a singal in anthor http request?
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream websocket {
server localhost:8010;
server localhost:8011;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/yourdomain.log;
location / {
proxy_pass http://websocket;
proxy_read_timeout 300s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}
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 reviewing the Lua API and the WebSocket proxy behavior shown in the issue configuration, focusing on how a later HTTP request could affect an existing TCP connection. Done means identifying a supported entry point for this cross-request closure or documenting the limitation and its expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, nginx
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100