Comments (6)
from lua-resty-upload.
conf/nginx.conf
http {
include mime.types;
default_type application/json;
log_format main '$time_iso8601 $remote_addr $request $host '
'$status $request_time $bytes_sent $body_bytes_sent '
'$upstream_addr $upstream_status $upstream_response_time '
'"$http_user_agent"';
access_log logs/access.log main;
sendfile on;
keepalive_timeout 30;
gzip on;
gzip_min_length 10k;
gzip_buffers 16 64k;
gzip_http_version 1.1;
gzip_comp_level 3;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
include *.http.conf;
}
conf/foobar1.http.conf
server {
listen 443 ssl;
server_name foobar1.com;
server_tokens off;
ssl_certificate foobar.com.crt;
ssl_certificate_key foobar.com.key;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 60m;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate Intermediate_Certificate.pem;
resolver 8.8.8.8 8.8.4.4 114.114.114.114 valid=300s;
resolver_timeout 5s;
default_type application/octet-stream;
access_log logs/foobar1.log main;
if ($request_method !~ ^(GET|HEAD|POST|OPTIONS|DELETE|PUT)$ ) {
return 444;
}
include upload.conf;
}
conf/foobar2.http.conf
server {
listen 443 ssl http2;
server_name foobar2.com;
server_tokens off;
ssl_certificate foobar.com.crt;
ssl_certificate_key foobar.com.key;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 60m;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate Intermediate_Certificate.pem;
resolver 8.8.8.8 8.8.4.4 114.114.114.114 valid=300s;
resolver_timeout 5s;
access_log logs/foobar2.log main;
if ($request_method !~ ^(GET|HEAD|POST|OPTIONS|DELETE|PUT)$ ) {
return 444;
}
location / {
alias /opt/foobar2/;
index index.html;
}
}
conf/upload.conf
location /upload {
auth_request /auth/upload.json;
client_body_buffer_size 10m;
client_max_body_size 20m;
content_by_lua_file 'conf/lua/upload.lua';
}
conf/lua/upload.lua
package.path = '/usr/local/share/lua/5.1/?.lua;/opt/nginx/conf/lua/resty/?.lua;'
package.cpath = '/usr/local/lib/lua/5.1/?.so;'
if ngx.var.request_method == "GET" then
ngx.log(ngx.ERR, "upload does not allow GET method")
ngx.exit(412)
end
local upload = require "upload"
local chunk_size = 4096
local form = upload:new(chunk_size)
conf/lua/resty/upload.lua
local req_socket = ngx.req.socket
function _M.new(self, chunk_size)
local boundary = get_boundary()
if not boundary then
return nil, "no boundary defined in Content-Type"
end
local sock, err = req_socket()
if not sock then
return nil, err
end
end
When I tried to upload a file through https://foobar1.com/upload
, the error happened.
Show your simplified configuration, please. pon., 29.04.2019, 14:35 użytkownik ncubrian [email protected] napisał:
…
I'm using the following version of Nginx. nginx version: nginx/1.14.0 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --prefix=/opt/nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_stub_status_module --with-threads --with-stream --with-stream_ssl_module --add-module=/tmp/ngx_devel_kit-0.3.0 --add-module=/tmp/lua-nginx-module-0.10.9rc7 I have defined four virtual servers in http config block. One virtual server is defined with listen 443 ssl;, while three other virtual servers are defined with listen 443 ssl http2;. The lua-nginx-module is used in the server without http2 configured to handle file upload. The code is as follows. local req_socket = ngx.req.socket local sock, err = req_socket() if not sock then return nil, err end Strange thing is the error.log reports that http v2 is not supported yet. But the http2 is not even configured in this virtual server. The error log is as below. 2019/04/29 15:26:19 [error] 22281#22281: *6512 lua entry thread aborted: runtime error: /opt/nginx/co nf/lua/resty/upload.lua:61: http v2 not supported yet stack traceback: coroutine 0: [C]: in function 'req_socket' /opt/nginx/conf/lua/resty/upload.lua:61: in function 'new' It looks like the http2 configuration exists beyond the virtual server in which it's configured, like somehow it becomes a global thing. After I delete the http2 in all three other virtual servers, the error.log stops reporting the error mentioned above. I don't know what make this happen. Is it a bug or something wrong with my configuration? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#50>, or mute the thread https://github.com/notifications/unsubscribe-auth/AADOT5VC67HIYQBLJXMN6TTPS3TP3ANCNFSM4HJC4ZWA .
from lua-resty-upload.
Show your simplified configuration, please. pon., 29.04.2019, 14:35 użytkownik ncubrian [email protected] napisał:
Hello friend, do you have any clues?
from lua-resty-upload.
I have the same problem too. It don't work when I upload by browser, but it work when I upload by Postman. Removing http2 from all configs can fix this problem, but it's not a good way(
from lua-resty-upload.
Got the same error message :|
from lua-resty-upload.
Same over here with openresty/1.15.8.1
from lua-resty-upload.
Related Issues (20)
- oh,i want say something,openresty always have problem in upload image file HOT 4
- Does this support multiple upload? HOT 4
- rest client上传的binary无法正确获取
- Subrequest question HOT 1
- How to reconstruct body after upload HOT 1
- Publish v0.10 on OPM HOT 1
- error module 'cjson' not found HOT 1
- HTTPS upload? HOT 2
- How to build a module to nginx? HOT 1
- Iterator to work with generic for HOT 1
- If the uploaded file is a picture,I want it to be a 2048 by 2048 image with maximum height and width
- ngx.exit(415) during read() loop does *not* cleanly exit - binary data spewed in log files
- security issues when use in WAF project
- where will I find the file uploaded
- How to download folder content from nginx server
- Got "closed" error after call read method of resty.upload HOT 3
- 请求解决一下http v2 支持的问题 HOT 1
- Support optional compatibility to LF as line break
- Biblioteca jose do python não chama a função jwt
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-resty-upload.