Skip to content

Commit

Permalink
core: remove nginx redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Sep 18, 2024
1 parent 7c300ca commit 5600e0a
Showing 1 changed file with 38 additions and 58 deletions.
96 changes: 38 additions & 58 deletions core/tools/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -55,82 +55,71 @@ http {

location /ardupilot-manager {
include cors.conf;
rewrite ^/ardupilot-manager$ /ardupilot-manager/ redirect;
rewrite ^/ardupilot-manager/(.*)$ /$1 break;
proxy_pass http://localhost:8000;
rewrite ^/ardupilot-manager(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:8000;
}

location /bag {
include cors.conf;
rewrite ^/bag$ /bag/ redirect;
rewrite ^/bag/(.*)$ /$1 break;
proxy_pass http://localhost:9101;
rewrite ^/bag(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:9101;
}

location /beacon {
include cors.conf;
rewrite ^/beacon$ /beacon/ redirect;
rewrite ^/beacon/(.*)$ /$1 break;
proxy_pass http://localhost:9111;
rewrite ^/beacon(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:9111;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Interface-Ip $server_addr;
}

location /bridget {
include cors.conf;
rewrite ^/bridget$ /bridget/ redirect;
rewrite ^/bridget/(.*)$ /$1 break;
proxy_pass http://localhost:27353;
rewrite ^/bridget(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:27353;
}

location /cable-guy {
include cors.conf;
rewrite ^/cable-guy$ /cable-guy/ redirect;
rewrite ^/cable-guy/(.*)$ /$1 break;
proxy_pass http://localhost:9090;
rewrite ^/cable-guy(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:9090;
}

location /commander {
include cors.conf;
rewrite ^/commander$ /commander/ redirect;
rewrite ^/commander/(.*)$ /$1 break;
proxy_pass http://localhost:9100;
rewrite ^/commander(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:9100;
}

location /docker {
limit_except GET {
deny all;
}
rewrite ^/docker$ /docker/ redirect;
rewrite ^/docker/(.*)$ /$1 break;
rewrite ^/docker(/|$)(.*)$ /$2 break;
proxy_pass http://unix:/var/run/docker.sock:/;
}

location /file-browser {
rewrite ^/file-browser$ /file-browser/ redirect;
rewrite ^/file-browser/(.*)$ /$1 break;
proxy_pass http://localhost:7777;
rewrite ^/file-browser(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:7777;
}

location /helper {
include cors.conf;
rewrite ^/helper$ /helper/ redirect;
rewrite ^/helper/(.*)$ /$1 break;
proxy_pass http://localhost:81;
rewrite ^/helper(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:81;
}

location /kraken {
include cors.conf;
rewrite ^/kraken$ /kraken/ redirect;
rewrite ^/kraken/(.*)$ /$1 break;
proxy_pass http://localhost:9134;
rewrite ^/kraken(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:9134;
}

location /nmea-injector {
include cors.conf;
rewrite ^/nmea-injector$ /nmea-injector/ redirect;
rewrite ^/nmea-injector/(.*)$ /$1 break;
proxy_pass http://localhost:2748;
rewrite ^/nmea-injector(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:2748;
}

location ^~ /logviewer {
Expand All @@ -144,9 +133,8 @@ http {
proxy_hide_header Access-Control-Allow-Origin;

include cors.conf;
rewrite ^/mavlink2rest$ /mavlink2rest/ redirect;
rewrite ^/mavlink2rest/(.*)$ /$1 break;
proxy_pass http://localhost:6040;
rewrite ^/mavlink2rest(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:6040;
# next two lines are required for websockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
Expand All @@ -157,8 +145,7 @@ http {
proxy_hide_header Access-Control-Allow-Origin;

include cors.conf;
rewrite ^/webrtc$ /webrtc/ redirect;
rewrite ^/webrtc/(.*)$ /$1 break;
rewrite ^//webrtc/ws(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:6021;
proxy_http_version 1.1;
# next two lines are required for websockets
Expand All @@ -168,62 +155,55 @@ http {

location /mavlink-camera-manager {
include cors.conf;
rewrite ^/mavlink-camera-manager$ /mavlink-camera-manager/ redirect;
rewrite ^/mavlink-camera-manager/(.*)$ /$1 break;
proxy_pass http://localhost:6020;
rewrite ^/mavlink-camera-manager(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:6020;
}

location /network-test {
include cors.conf;
rewrite ^/network-test$ /network-test/ redirect;
rewrite ^/network-test/(.*)$ /$1 break;
proxy_pass http://localhost:9120;
rewrite ^/network-test(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:9120;
# next two lines are required for websockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}

location /system-information {
include cors.conf;
rewrite ^/system-information$ /system-information/ redirect;
rewrite ^/system-information/(.*)$ /$1 break;
proxy_pass http://localhost:6030;
rewrite ^/system-information(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:6030;
# next two lines are required for websockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}

location /terminal {
rewrite ^/terminal$ /terminal/ redirect;
rewrite ^/terminal/(.*)$ /$1 break;
proxy_pass http://localhost:8088;
rewrite ^/terminal(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:8088;
# next two lines are required for websockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}

location /version-chooser {
include cors.conf;
rewrite ^/version-chooser$ /version-chooser/ redirect;
rewrite ^/version-chooser/(.*)$ /$1 break;
proxy_pass http://localhost:8081;
rewrite ^/version-chooser(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:8081;
proxy_buffering off;
expires -1;
add_header Cache-Control no-store;
}

location /wifi-manager {
include cors.conf;
rewrite ^/wifi-manager$ /wifi-manager/ redirect;
rewrite ^/wifi-manager/(.*)$ /$1 break;
proxy_pass http://localhost:9000;
rewrite ^/wifi-manager(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:9000;
}

location /ping {
include cors.conf;
rewrite ^/ping$ /ping/ redirect;
rewrite ^/ping/(.*)$ /$1 break;
proxy_pass http://localhost:9110;
rewrite ^/ping(/|$)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:9110;
}

location / {
Expand Down

0 comments on commit 5600e0a

Please sign in to comment.