i have nginx for proxy problem.
follow in problem descripton:
i have 3 host vm , designations foo ,bar1,bar2
my network framwork like this:
question : when i try to get the document server script file of api.js
the broswer ask me :
finally ,i want set config nginx Virtual path to connect documentserver that got app.js file
this is my nginx of main host config :
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
upstream onlyoffice{
server 172.17.11.27:80;
}
map $http_x_forwarded_proto $the_scheme {
default $http_x_forwarded_proto;
"" $scheme;
}
map $http_x_forwarded_host $the_host {
default $http_x_forwarded_host;
"" $host;
}
map $http_upgrade $proxy_connection {
default upgrade;
"" close;
}
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host/documentserver-virtual-path;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
include mime.types;
default_type application/octet-stream;
client_max_body_size 10240m;
#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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_buffers 4 16k;
gzip_comp_level 5;
gzip_min_length 100;
gzip_types text/plain application/javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
server {
listen 28080;
server_name xxxxxxx;
charset utf-8;
access_log logs/host.access.log main;
add_header Access-Control-Allow-Origin '*';
add_header Access-Control-Allow-Credentials "true";
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'token,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,XRequested-With';
if ($request_method = 'OPTIONS') {
return 200;
}
location / {
root /usr/local/data/nginx/html/dist;
index index.html index.htm;
try_files $uri $uri/ @router;
}
location @router {
rewrite ^.*$ /index.html last;
}
location /stage-api/ { #my application callback server
client_max_body_size 10240m;
proxy_pass http://172.17.11.24:8080/;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarder-For @proxy_add_x_forwarded_for;
proxy_set_header Product_Type 2;
}
location /onlyoffice-api/ {
proxy_pass http://onlyoffice; # documentserver
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarder-For @proxy_add_x_forwarded_for;
proxy_set_header Product_Type 2;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /dev-api/ {
proxy_pass http://172.17.11.24:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarder-For @proxy_add_x_forwarded_for;
proxy_set_header Product_Type 2;
}
location /prod-api/ {
proxy_pass http://172.17.11.24:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarder-For @proxy_add_x_forwarded_for;
proxy_set_header Product_Type 2;
}
location /fileonline/ {
proxy_pass http://172.17.11.24:18080/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
and the documentserver nginx is default config :
Document Server version:7.3
Type of installation of the Document Server (docker, deb/rpm, exe)
OS:centos 7
Browser version:chorm