Raymond Weitekamp commited on
Commit
c0a58d3
·
1 Parent(s): c6c2ad4

Fix startup sequence to ensure NiceGUI is ready before Nginx

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -7
  2. cadviewer.py +1 -1
Dockerfile CHANGED
@@ -62,12 +62,9 @@ events {\n\
62
  worker_connections 1024;\n\
63
  }\n\
64
  http {\n\
65
- # Disable access logging for normal requests\n\
66
  access_log off;\n\
67
- # Only log errors\n\
68
  error_log stderr error;\n\
69
  \n\
70
- # Ignore common client disconnect errors\n\
71
  log_not_found off;\n\
72
  \n\
73
  client_max_body_size 0;\n\
@@ -89,7 +86,6 @@ http {\n\
89
  listen 7860;\n\
90
  server_name localhost;\n\
91
  \n\
92
- # Disable logging of client connection resets\n\
93
  proxy_ignore_client_abort on;\n\
94
  \n\
95
  # Main app (NiceGUI)\n\
@@ -104,9 +100,9 @@ http {\n\
104
  proxy_set_header X-Forwarded-Proto $scheme;\n\
105
  }\n\
106
  \n\
107
- # Viewer route - handle both /viewer and /viewer/ paths\n\
108
- location ~ ^/viewer/?(.*)$ {\n\
109
- proxy_pass http://viewer/viewer/$1;\n\
110
  proxy_http_version 1.1;\n\
111
  proxy_set_header Upgrade $http_upgrade;\n\
112
  proxy_set_header Connection $connection_upgrade;\n\
 
62
  worker_connections 1024;\n\
63
  }\n\
64
  http {\n\
 
65
  access_log off;\n\
 
66
  error_log stderr error;\n\
67
  \n\
 
68
  log_not_found off;\n\
69
  \n\
70
  client_max_body_size 0;\n\
 
86
  listen 7860;\n\
87
  server_name localhost;\n\
88
  \n\
 
89
  proxy_ignore_client_abort on;\n\
90
  \n\
91
  # Main app (NiceGUI)\n\
 
100
  proxy_set_header X-Forwarded-Proto $scheme;\n\
101
  }\n\
102
  \n\
103
+ # Viewer route\n\
104
+ location /viewer/ {\n\
105
+ proxy_pass http://viewer;\n\
106
  proxy_http_version 1.1;\n\
107
  proxy_set_header Upgrade $http_upgrade;\n\
108
  proxy_set_header Connection $connection_upgrade;\n\
cadviewer.py CHANGED
@@ -201,7 +201,7 @@ with ui.splitter().classes(
201
  logger.info(f"Space URL: {space_url}")
202
 
203
  # Construct the viewer URL - use relative path for both local and Space environments
204
- viewer_url = "/viewer/" # Changed to match Nginx configuration
205
  logger.info(f"Using viewer URL: {viewer_url}")
206
 
207
  ocpcv = (
 
201
  logger.info(f"Space URL: {space_url}")
202
 
203
  # Construct the viewer URL - use relative path for both local and Space environments
204
+ viewer_url = "/viewer" # Changed to match Nginx configuration
205
  logger.info(f"Using viewer URL: {viewer_url}")
206
 
207
  ocpcv = (