Skip to content

Instantly share code, notes, and snippets.

@devleaks
Created August 10, 2024 08:34
Show Gist options
  • Select an option

  • Save devleaks/729bda6db10007b844111178694c7971 to your computer and use it in GitHub Desktop.

Select an option

Save devleaks/729bda6db10007b844111178694c7971 to your computer and use it in GitHub Desktop.
nginx config to allow access to X-Plane REST/Websocket API on your entire LAN
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
upstream websocket {
server 127.0.0.1:8086;
#SERVER endpoint that handle ws:// connections
}
server {
listen 8080;
server_name mac-mini-de-pierre.local;
location / {
proxy_pass http://127.0.0.1:8086;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# WebSocket support
# https://stackoverflow.com/questions/12102110/nginx-to-reverse-proxy-websockets-and-enable-ssl-wss
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment