我试图上传文件,当api直接调用时,它工作正常,但当它在代理之后时,它不工作,我使用nginx作为反向代理
NGINX-v
nginx版本:nginx/1.15.0
也进行了1.17测试,相同
操作系统:CentOS 7.0
FORNTEN:React,使用axios
后端:nodejs 10
我错过什么了吗?
http设置:
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;
sendfile on;
#tcp_nopush on;
client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 30M;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*.conf;
}
server {
listen 80;
server_name my_server_name;
return 301 https://my_server_name;
}
server {
listen 443 ssl default_server;
server_name my_server_name;
ssl_certificate path_to_cert;
ssl_certificate_key path_to_key;
root path_to_build;
index index.html index.htm;
client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 30M;
location /api/ {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:3003/api/;
proxy_pass_request_headers on;
proxy_cache off;
client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 30M;
}
location / {
try_files $uri /index.html;
}
}
还删除了client_body_in_file_only&client\u body\u buffer\u大小仍然相同
任何帮助都将不胜感激