openresty / openresty/lua-nginx-module
Receive duplicate response header `Connection: upgrade`
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 simulate an HTTP 101 status code as follows.
# nginx.conf
worker_processes 1;
error_log logs/error.log debug;
events {
worker_connections 1024;
}
http {
lua_code_cache on;
lua_package_path 'assets/?.lua;;';
server {
server_name www.example.com;
listen 80;
default_type text/html;
access_log logs/access.log combined;
location / {
header_filter_by_lua_block {
ngx.status = ngx.HTTP_SWITCHING_PROTOCOLS
ngx.header["Connection"] = 'upgrade'
ngx.header["Upgrade"] = 'foo/1, webscocket,bar/2'
return ngx.exit(ngx.HTTP_OK)
}
}
}
}
But got duplicate Connection: upgrade header:
root@73c270625dcb:/# curl -i localhost
HTTP/1.1 101 Switching Protocols
Server: openresty/1.25.3.2
Date: Fri, 07 Feb 2025 12:11:28 GMT
Content-Length: 0
Connection: upgrade
Connection: upgrade
Upgrade: foo/1, webscocket,bar/2
curl: (52) Empty reply from server
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 with the nginx.conf reproduction and the header_filter_by_lua_block shown in the issue, then run the curl request to inspect the HTTP/1.1 response. Trace how the 101 response and ngx.header["Connection"] are handled; done means the response contains only one Connection: upgrade header while retaining the Upgrade header.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, nginx
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100