I was finally able to get Xojo Web to work behind a reverse proxy using a path. Thank you community! This is useful for hosting two differnet xojo web instances on one server. WebApp1 can redirect you two WebApp2 using a relative path regardless of the server or client IP/DNS name. In my case, I need WebApp1 to show WebApp2 in an iframe.
I could see from running nginx -V
the module was already installed. Apparently it is installed on nginx-full and nginx-extra by default. You need to run gzip_disable ".";
to make it actually work though.
It was a bit painful, and this will probably break when the framework updates, but this works for me. This could also break if you use some parts of XojoWeb that my app doesn’t use.
[code]server {
listen 80 default_server;
listen 443 ssl;
root /config/www;
index index.html index.htm index.php;
server_name _;
ssl_certificate /config/keys/cert.crt;
ssl_certificate_key /config/keys/cert.key;
client_max_body_size 0;
location / {
proxy_pass http://127.0.0.1:8090/;
}
location /manage/framework {
gunzip on;
gzip_disable ".";
sub_filter_once off;
sub_filter_types *; #allows sub_filter to edit js and css
sub_filter '"/' '"/manage/';
sub_filter '/framework' '/manage/framework';
rewrite /manage/(.*) /$1 break;
proxy_pass http://127.0.0.1:8070/;
proxy_redirect off;
proxy_set_header Host $host;
}
location /manage {
gunzip on;
gzip_disable ".";
sub_filter_once off;
sub_filter_types *; #allows sub_filter to edit js and css
sub_filter 'url(/framework' 'url(/manage/framework';
sub_filter '/framework' '/manage/framework';
sub_filter '="/' '="/manage/';
sub_filter 'setSource(' 'setSource(\\'manage\\' + ';
#sub_filter 'setSource("' 'setSource("/manage';
sub_filter '/_files' '/manage/_files';
rewrite /manage/(.*) /$1 break;
proxy_pass http://127.0.0.1:8070/;
proxy_redirect off;
proxy_set_header Host $host;
}
....
}[/code]