Docker-DocumentServer
Docker-DocumentServer copied to clipboard
js path missing on page load,Second-level domain name lost
api.js is loaded through vue like this https://idemo.com/onlineEditor/web-apps/apps/api/documents/api.js

The final access address is https://10.16.11.11:9000/web-apps/apps/api/documents/api.js
The relationship of domain name mapping is idemo.com/onlineEditor/onlineEditor --->10.16.11.11:9000
But when loading https://idemo.com/onlineEditor/web-apps/apps/documenteditor/main/index.html, directly switch to https://idemo.com/7.1.1-23/web -apps/apps/documenteditor/main/index.html;
Second-level domain name lost ! /onlineEditor lost ! The address required here is https://idemo.com/onlineEditor/7.1.1-23/web -apps/apps/documenteditor/main/index.html


I started it through docker, how should I configure to keep this second-level domain name so that the second-level domain name is not lost
Hi, not sure but I think DocumentServer docker is not designed that way so it can be part of subdomain
In that case you should manually setup nginx and forward https://idemo.com/onlineEditor/web-apps/apps/documenteditor/main/index.html to https://10.16.11.11:9000/web-apps/apps/api/documents/api.js
Hi, not sure but I think DocumentServer docker is not designed that way so it can be part of subdomain
In that case you should manually setup nginx and forward
https://idemo.com/onlineEditor/web-apps/apps/documenteditor/main/index.htmltohttps://10.16.11.11:9000/web-apps/apps/api/documents/api.js
This path **https://idemo.com/onlineEditor/web-apps**/apps/documenteditor/main/index.html will redirect to https:/**/idemo.com/7.1.1-23**/web-apps/apps/documenteditor /main/index.html,
the second-level domain name onlineEditor is lost!!
@igwyd Pleas take a look, if ever had experience with such configurations
Hello @nomatterfine, it's https://idemo.com/onlineEditor/ this isn't called a second-level domain, but a subfolder. Your problem with your proxy setting i think. We don't have approved configs for proxying documentserver to the subfolder, but i cheked my nginx custom configuration and it is work.
My nginx config:
# Example for use the document server at subfolder.
# Replace {{SSL_CERTIFICATE_PATH}} with the path to the ssl certificate file
# Replace {{SSL_KEY_PATH}} with the path to the ssl private key file
# Replace {{SERVER_NAME}} with the domain name
# Replace {{DOCUMENTSERVER_ADDRESS}} with the backend server address
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;
}
server {
listen 80;
server_name {{SERVER_NAME}};
rewrite ^ https://$http_host$request_uri? permanent;
server_tokens off;
}
server {
listen 443 http2;
ssl on;
ssl_certificate {{SSL_CERTIFICATE_PATH}};
ssl_certificate_key {{SSL_KEY_PATH}};
server_name {{SERVER_NAME}};
proxy_set_header X-Forwarded-For $remote_addr;
server_tokens off;
location /onlyoffice/ {
proxy_pass https://{{DOCUMENTSERVER_ADDRESS}}/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host/onlyoffice;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
I hope it help you.
I'm also running into this issue. I believe something in the JS that makes the call to the root host instead of the proxy path.
|
Iframe path is getting the correct one from the getBasePath function which is basically getting the proxy path from the api.js script tag
| Script tag with proxy path | Iframe gets the correct proxy path |
|---|---|
|
|
function getBasePath() {
var scripts = document.getElementsByTagName('script'),
match;
for (var i = scripts.length - 1; i >= 0; i--) {
match = scripts[i].src.match(/(.*)api\/documents\/api.js/i);
if (match) {
return match[1];
}
}
return "";
}
call to the cache/file endpoint should use the same getBasePath function to resolve it correctly ?
Hello @iqbalhasnan. I also think that you have the same problem as @nomatterfine. It's important that x-forwarded-proto and x-forwarded-host with virtual directory(subfolder) headers are sent or it can be specified in x-forwarded-prefix header.
This issue was closed due to no response.
if use subFolder or not port 80, the config should be like:
location /onlyoffice/ {
proxy_pass https://{{DOCUMENTSERVER_ADDRESS}}/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host:$server_port/onlyoffice;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
the onlyoffice is your subFolder, the server_port is your custom port.