1
0

dune-weaver.conf 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. server {
  2. listen 80;
  3. server_name _;
  4. # Increase max upload size for pattern files
  5. client_max_body_size 10M;
  6. # Gzip compression for faster page loads (especially on Pi WiFi)
  7. gzip on;
  8. gzip_vary on;
  9. gzip_min_length 1024;
  10. gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml;
  11. # Frontend - serve static files
  12. location / {
  13. root INSTALL_DIR_PLACEHOLDER/static/dist;
  14. index index.html;
  15. try_files $uri $uri/ /index.html;
  16. }
  17. # Captive portal detection probes → backend serves redirect page
  18. # In hotspot mode, DNS resolves all domains to the Pi.
  19. # Phones probe these well-known paths to detect captive portals.
  20. location ~ ^/(hotspot-detect\.html|generate_204|connecttest\.txt|ncsi\.txt|redirect|canonical\.html)$ {
  21. proxy_pass http://127.0.0.1:8080;
  22. proxy_set_header Host $host;
  23. proxy_set_header X-Real-IP $remote_addr;
  24. }
  25. # API proxy to backend
  26. location /api/ {
  27. proxy_pass http://127.0.0.1:8080;
  28. proxy_set_header Host $host;
  29. proxy_set_header X-Real-IP $remote_addr;
  30. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  31. proxy_set_header X-Forwarded-Proto $scheme;
  32. }
  33. # WebSocket proxy
  34. location /ws/ {
  35. proxy_pass http://127.0.0.1:8080;
  36. proxy_http_version 1.1;
  37. proxy_set_header Upgrade $http_upgrade;
  38. proxy_set_header Connection "upgrade";
  39. proxy_set_header Host $host;
  40. proxy_set_header X-Real-IP $remote_addr;
  41. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  42. proxy_read_timeout 86400;
  43. }
  44. # Static files from backend (pattern previews, custom logos)
  45. location /static/ {
  46. proxy_pass http://127.0.0.1:8080;
  47. proxy_set_header Host $host;
  48. proxy_set_header X-Real-IP $remote_addr;
  49. proxy_cache_valid 200 1h;
  50. }
  51. # All backend API endpoints (legacy non-/api/ routes)
  52. 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) {
  53. proxy_pass http://127.0.0.1:8080;
  54. proxy_set_header Host $host;
  55. proxy_set_header X-Real-IP $remote_addr;
  56. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  57. proxy_set_header X-Forwarded-Proto $scheme;
  58. }
  59. }