Nginx reverse proxy
Nginx reverse proxy
Hi,
It's possible to use Nginx as Virtual Radar reverse proxy?
I tried the follow nginx host configuration:
Server {
listen 80;
index index.html index.htm index.php;
server_name radar.jorgemota.pt;
location / {
proxy_pass http://127.0.0.1:8085/VirtualRadar;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
}
without success. The url is redirected to http://radar.jorgemota.pt//desktop.html but without any content.
Thanks in Advance.
It's possible to use Nginx as Virtual Radar reverse proxy?
I tried the follow nginx host configuration:
Server {
listen 80;
index index.html index.htm index.php;
server_name radar.jorgemota.pt;
location / {
proxy_pass http://127.0.0.1:8085/VirtualRadar;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
}
without success. The url is redirected to http://radar.jorgemota.pt//desktop.html but without any content.
Thanks in Advance.
Re: Nginx reverse proxy
This configuration works!
server {
listen 80;
index index.html index.htm index.php;
server_name radar.jorgemota.pt;
location / {
proxy_pass http://127.0.0.1:8085/VirtualRadar/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
}
A little front slash makes all the diference!
server {
listen 80;
index index.html index.htm index.php;
server_name radar.jorgemota.pt;
location / {
proxy_pass http://127.0.0.1:8085/VirtualRadar/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
}
A little front slash makes all the diference!
Re: Nginx reverse proxy
You may also need to tell VRS that it's behind a reverse proxy by going into Tools | Options | Web Site and setting the proxy type to "Reverse".
Re: Nginx reverse proxy
Maybe a better solution:
- first of all figure out if mobile browser or not
- after this open mobile or desktop page via nginx reverse proxy
now you can open your VRS page via http://www.yourDomain/vrs
- first of all figure out if mobile browser or not
- after this open mobile or desktop page via nginx reverse proxy
Code: Select all
set $mobile_request false;
if ($http_user_agent ~* '(Mobile|WebOS)') {
set $mobile_request true;
}
if ($mobile_request = true) {
rewrite ^/vrs/$ /vrs/VirtualRadar\mobile.html permanent;
rewrite ^/vrs$ /vrs/VirtualRadar\mobile.html permanent;
}
if ($mobile_request = false) {
rewrite ^/vrs/$ /vrs/VirtualRadar\desktop.html permanent;
rewrite ^/vrs$ /vrs/VirtualRadar\desktop.html permanent;
}
location /vrs {
rewrite /vrs/(.*) /$1 break;
access_log /var/log/nginx/vrs.access.log;
error_log /var/log/nginx/vrs.error.log;
proxy_pass http://localhost:8082;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
Re: Nginx reverse proxy
What does this do?agw wrote:You may also need to tell VRS that it's behind a reverse proxy by going into Tools | Options | Web Site and setting the proxy type to "Reverse".
Re: Nginx reverse proxy
From memory it's involved in working out the correct redirect address when a browser asks for <your ip address>/VirtualRadar.
Re: Nginx reverse proxy
Did anyone manage to pass the external ip to VRS, so you can see the IP that's accessing the radar?
-
- Posts: 2
- Joined: Wed Jun 27, 2018 10:53 am
Re: Nginx reverse proxy
I bumping this up because the mentioned solutions don't fully work.
In my case the access url is: vradar.domain.com
The internal url is: http://192.168.1.44:8888/
Here are my findings:
This was the originally proposed solution:
This will only work if someone enters the VirtualRadar in the URL for example: https://vradar.domain.com/VirtualRadar/
Which is just ugly but works.
I have found a solution for this:
This will work however none of the aircraft pictures will show up anymore. I guess it breaks the external feed somehow. Corrections are welcome.
In my case the access url is: vradar.domain.com
The internal url is: http://192.168.1.44:8888/
Here are my findings:
This was the originally proposed solution:
Code: Select all
location / {
proxy_pass http://192.168.1.44:8888/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
Which is just ugly but works.
I have found a solution for this:
Code: Select all
location ~ ^/(.*)$ {
proxy_pass http://192.168.1.44:8888/$1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}