dune-weaver.conf 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. server {
  2. listen 80;
  3. server_name _;
  4. # Increase max upload size for pattern files
  5. client_max_body_size 10M;
  6. # Frontend - serve static files
  7. location / {
  8. root INSTALL_DIR_PLACEHOLDER/static/dist;
  9. index index.html;
  10. try_files $uri $uri/ /index.html;
  11. }
  12. # Captive portal detection probes → backend serves redirect page
  13. # In hotspot mode, DNS resolves all domains to the Pi.
  14. # Phones probe these well-known paths to detect captive portals.
  15. location ~ ^/(hotspot-detect\.html|generate_204|connecttest\.txt|ncsi\.txt|redirect|canonical\.html)$ {
  16. proxy_pass http://127.0.0.1:8080;
  17. proxy_set_header Host $host;
  18. proxy_set_header X-Real-IP $remote_addr;
  19. }
  20. # API proxy to backend
  21. location /api/ {
  22. proxy_pass http://127.0.0.1:8080;
  23. proxy_set_header Host $host;
  24. proxy_set_header X-Real-IP $remote_addr;
  25. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  26. proxy_set_header X-Forwarded-Proto $scheme;
  27. }
  28. # WebSocket proxy
  29. location /ws/ {
  30. proxy_pass http://127.0.0.1:8080;
  31. proxy_http_version 1.1;
  32. proxy_set_header Upgrade $http_upgrade;
  33. proxy_set_header Connection "upgrade";
  34. proxy_set_header Host $host;
  35. proxy_set_header X-Real-IP $remote_addr;
  36. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  37. proxy_read_timeout 86400;
  38. }
  39. # Static files from backend (pattern previews, custom logos)
  40. location /static/ {
  41. proxy_pass http://127.0.0.1:8080;
  42. proxy_set_header Host $host;
  43. proxy_set_header X-Real-IP $remote_addr;
  44. proxy_cache_valid 200 1h;
  45. }
  46. # All backend API endpoints (legacy non-/api/ routes)
  47. location ~ ^/(list_theta_rho_files|preview_thr_batch|get_theta_rho_coordinates|upload_theta_rho|pause_execution|resume_execution|stop_execution|force_stop|soft_reset|skip_pattern|set_speed|get_speed|restart|shutdown|run_pattern|run_playlist|connect_device|disconnect_device|home_device|clear_sand|move_to_position|get_playlists|save_playlist|delete_playlist|rename_playlist|reorder_playlist|delete_theta_rho_file|get_status|list_serial_ports|serial_status|cache-progress|rebuild_cache|get_led_config|set_led_config|get_wled_ip|set_wled_ip|led|send_home|send_coordinate|move_to_center|move_to_perimeter|run_theta_rho|connect|disconnect|list_theta_rho_files_with_metadata|list_all_playlists|get_playlist|create_playlist|modify_playlist|add_to_playlist|preview_thr|preview|add_to_queue|restart_connection|controller_restart|recover_sensor_homing|run_theta_rho_file|download|check_software_update|update_software) {
  48. proxy_pass http://127.0.0.1:8080;
  49. proxy_set_header Host $host;
  50. proxy_set_header X-Real-IP $remote_addr;
  51. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  52. proxy_set_header X-Forwarded-Proto $scheme;
  53. }
  54. }