Skip to content

Commit

Permalink
add sample nginx config to proxy access to mtda
Browse files Browse the repository at this point in the history
This adds an example nginx configuration file to access multiple mtda
devices via a reverse proxy. By that, users can access a set of mtda
devices via a single web-frontend and without having IP access to each
individual MTDA device.

Signed-off-by: Felix Moessbauer <[email protected]>
  • Loading branch information
fmoessbauer committed Jul 28, 2023
1 parent 146aaef commit b219263
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions mtda/share/nginx-multi-mtda.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This software is a part of MTDA.
# Copyright (C) 2023 Siemens AG
#
# This example provides a nginx site config to access
# one or more MTDA devices via a single web frontend
# The devices can be accessed using <host>/device/<ip>/

server {
listen 80;
listen [::]:80;

location / {
proxy_pass http://mtda-web;
}

# to restrict access to the MTDA devices, fine-tune this rule
location ~* ^/device/(?<phost>[\d.]+)(?<puri>/.*) {
set $adr http://$phost;
rewrite .* $puri break;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_pass $adr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}

upstream mtda-web {
server unix:/run/testbed-webserver/http.sock;
}

0 comments on commit b219263

Please sign in to comment.