У нас есть следующая архитектура приложения Docker, использующая серверы nginx и nodejs
application_router[a,b,c] -> application_serveices[x,y,z] -> z_node.js -> S3
У меня есть файл TSV 600 МБ, который при загрузке непосредственно в application_serveices (z), а Z использует nginx proxy_pass, возвращает ответ 200 в 100% случаев.
Когда я загружаю тот же файл TSV, но использую nginx application_router (a) -> z, я получаю следующую ошибку:
от z:
node_1 | objectStore:metadata:file { fieldname: 'TSV-FILE',
node_1 | originalname: 'some.tsv',
node_1 | encoding: '7bit',
node_1 | mimetype: 'text/tab-separated-values' }
nginx_proxy | 192.168.192.1 - - [16/Jan/2019:01:06:18 +0000] "POST /z/api/source/upload HTTP/1.0" 400 0 "-" "PostmanRuntime/7.4.0" "-"
node_1 | 192.168.192.7 - - [16/Jan/2019:01:06:19 +0000] "POST /z/api/source/upload HTTP/1.0" - - "-" "PostmanRuntime/7.4.0" <----- node does not get a http status code
из:
nginx_1 | 172.18.0.1 - - [16/Jan/2019:01:05:44 +0000] "POST /z/api/source/upload HTTP/1.1" 502 157 "-" "PostmanRuntime/7.4.0"
nginx_1 | 2019/01/16 01:05:58 [warn] 6#6: *1 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000004, client: 172.18.0.1, server: localhost.mydomain.com, request: "POST /z/api/source/upload HTTP/1.1", host: "localhost.mydomain.com"
nginx_1 | 2019/01/16 01:06:18 [error] 6#6: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.18.0.1, server: localhost.mydomain.com, request: "POST /z/api/source/upload HTTP/1.1", upstream: "http://172.18.0.2:4410/z/api/source/upload", host: "localhost.mydomain.com"
nginx_1 | 172.18.0.1 - - [16/Jan/2019:01:06:18 +0000] "POST /z/api/source/upload HTTP/1.1" 502 157 "-" "PostmanRuntime/7.4.0"
Я не вижу ошибок времени выполнения или перезапуска контейнера Docker.
Вопрос:
Почему nginx сбрасывает соединение?
application_serveice [z] nginx.conf file
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
proxy_buffering off;
proxy_request_buffering off;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
send_timeout 600s;
client_max_body_size 0;
server {
listen 80;
index index.html;
root /app;
location /z/ {
tcp_nopush on;
alias /app/;
try_files $uri$args $uri$args/ /index.html;
}
location /z/assets/ {
alias /app/assets/;
try_files $uri =404;
}
location /z/api/ {
tcp_nopush off;
proxy_pass http://service/z/api/;
auth_basic off;
}
}
}
application_router nginx.conf file
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
proxy_buffering off;
proxy_request_buffering off;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
client_max_body_size 0;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
server {
listen [::]:443 ssl default_server;
ssl_certificate /run/secrets/fullchain.pem;
ssl_certificate_key /run/secrets/privkey.pem;
return 301 https://$host$request_uri;
}
server {
listen 443;
ssl on;
ssl_certificate /run/secrets/fullchain.pem;
ssl_certificate_key /run/secrets/privkey.pem;
ssl_dhparam /run/secrets/dhparam.pem;
server_name localhost.mydomain.com;
location / {
rewrite ^ https://$host/x/ redirect;
}
location /x/ {
proxy_pass http://devstation:4010/x/;
}
location /y/ {
proxy_pass http://devstation:4110/y/;
}
location /z/ {
proxy_pass http://devstation:4410/z/;
}
}
}