Created
March 6, 2020 16:01
-
-
Save juancampa/634f9739a108bc5ea154c34e19343314 to your computer and use it in GitHub Desktop.
Minimal openresty config streaming HTTP V2 issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 443 ssl http2; | |
error_log stderr warn; | |
ssl_certificate /etc/certs/nginx-selfsigned.crt; | |
ssl_certificate_key /etc/certs/nginx-selfsigned.key; | |
server_name localhost; | |
location / { | |
access_by_lua_block { | |
ngx.header['content-length'] = "104857600" | |
local chunk = string.rep("x", 1024 * 8) | |
local total = 12800 | |
for i = 1, total do | |
local ok, err | |
if (i % 1000) == 0 then | |
ngx.log(ngx.WARN, 'STILL GOING ', i / total) | |
end | |
ok, err = ngx.print(chunk) | |
if not ok or err then | |
ngx.log(ngx.WARN, "ERROR PRINTING: ", err) | |
break | |
end | |
-- This never blocks when using HTTP2 | |
ok, err = ngx.flush(true) | |
if not ok or err then | |
ngx.log(ngx.WARN, "ERROR FLUSHING: ", err) | |
break | |
end | |
end | |
ngx.log(ngx.WARN, 'EXITING') | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment