Open tom2238 opened 3 years ago
Hmm, unsure about this one! There would also be issues with SocketIO's connections. It's probably possible but I'd need someone with a bit more experience with flask and flask-socketio to figure it out..
Hi, reverse proxy with subdirectory (eg. http://192.168.10.251/autorx/) didn't work, but if I use subdomain (eg. http://autosonde.dt.local/) it works. However this option request static DNS record in PC or in router.
go it working with this nginx config, but yes, the better way is to implement this feature native .. may be next time :-)
cat /etc/nginx/sites-enabled/reverse-proxy
server {
listen 80;
root /var/www/html;
index index.html;
server_name localhost;
location /chasemapper {
return 302 /chasemapper/;
}
location /chasemapper/ {
rewrite /chasemapper/(.*) /$1 break;
proxy_pass http://127.0.0.1:5001/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect / /chasemapper/;
## Required for websockets
proxy_http_version 1.1;
proxy_set_header Connection "upgrade";
proxy_set_header Upgrade $http_upgrade;
proxy_read_timeout 600s;
sub_filter_once off;
sub_filter_types *;
#sub_filter_types text/xml text/css text/javascript text/html html;
sub_filter 'Url="/' 'Url="/chasemapper/';
sub_filter ' href="/' ' href="/chasemapper/';
sub_filter ' src="/' ' src="/chasemapper/';
sub_filter ' action="/' ' action="/chasemapper/';
sub_filter '"/socket.io' '"/chasemapper/socket.io/';
sub_filter 'rl: "/' 'rl: "/chasemapper/';
sub_filter 'getJSON("/' 'getJSON("/chasemapper/';
sub_filter "+ '/tiles/'" "+ '/chasemapper/tiles/'";
# sub_filter '' '';
#sub_filter 'sourceMappingURL=socket.io.min.js.map' 'sourceMappingURL=/chasemapper/socket.io.min.js.map';
}
location /radiosonde-auto-rx {
return 302 /radiosonde-auto-rx/;
}
location /radiosonde-auto-rx/ {
proxy_pass http://127.0.0.1:5000/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
## Required for websockets
proxy_http_version 1.1;
proxy_set_header Connection "upgrade";
proxy_set_header Upgrade $http_upgrade;
proxy_read_timeout 600s;
sub_filter_once off;
sub_filter_types *;
#sub_filter_types text/xml text/css text/javascript text/html html;
sub_filter 'Url="/' 'Url="/radiosonde-auto-rx/';
sub_filter ' href="/' ' href="/radiosonde-auto-rx/';
sub_filter ' src="/' ' src="/radiosonde-auto-rx/';
sub_filter ' action="/' ' action="/radiosonde-auto-rx/';
sub_filter '"/socket.io' '"/radiosonde-auto-rx/socket.io/';
sub_filter 'rl: "/' 'rl: "/radiosonde-auto-rx/';
sub_filter 'getJSON("/' 'getJSON("/radiosonde-auto-rx/';
sub_filter "'href', '/" "'href', '/radiosonde-auto-rx/";
# sub_filter '' '';
#sub_filter 'sourceMappingURL=socket.io.min.js.map' 'sourceMappingURL=/radiosonde-auto-rx/socket.io.min.js.map';
}
}
Hi. Web options in station.cfg is now: web_host = 0.0.0.0 web_port = 5000 etc.. So. Is possible to add some "web_path = /autorx" option. I would like to use radiosonde_auto_rx behind Nginx reverse proxy like http://192.168.10.251/autorx/. Current possible usage is only with http://192.168.10.251:5000/. Or exists some easy code modification (eg. in index.html) to add /autorx/ prefix into URLs? Thanks.