From: Tom Clegg Date: Fri, 11 Mar 2022 14:37:38 +0000 (-0500) Subject: 18700: Fix wb2 section in nginx.conf template. X-Git-Tag: 2.5.0~214^2~29 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/3c4835a24aa6af9c7060c8b6d760a6eb32227774 18700: Fix wb2 section in nginx.conf template. Currently only for production mode. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- diff --git a/lib/boot/nginx.go b/lib/boot/nginx.go index b90c9b537a..f212254d23 100644 --- a/lib/boot/nginx.go +++ b/lib/boot/nginx.go @@ -33,12 +33,13 @@ func (runNginx) Run(ctx context.Context, fail func(error), super *Supervisor) er return err } vars := map[string]string{ - "LISTENHOST": super.ListenHost, - "SSLCERT": filepath.Join(super.tempdir, "server.crt"), - "SSLKEY": filepath.Join(super.tempdir, "server.key"), - "ACCESSLOG": filepath.Join(super.tempdir, "nginx_access.log"), - "ERRORLOG": filepath.Join(super.tempdir, "nginx_error.log"), - "TMPDIR": super.wwwtempdir, + "LISTENHOST": super.ListenHost, + "SSLCERT": filepath.Join(super.tempdir, "server.crt"), + "SSLKEY": filepath.Join(super.tempdir, "server.key"), + "ACCESSLOG": filepath.Join(super.tempdir, "nginx_access.log"), + "ERRORLOG": filepath.Join(super.tempdir, "nginx_error.log"), + "TMPDIR": super.wwwtempdir, + "ARVADOS_API_HOST": super.cluster.Services.Controller.ExternalURL.Host, } u := url.URL(super.cluster.Services.Controller.ExternalURL) ctrlHost := u.Hostname() diff --git a/sdk/python/tests/nginx.conf b/sdk/python/tests/nginx.conf index 44f8469b0a..bfb1226f7f 100644 --- a/sdk/python/tests/nginx.conf +++ b/sdk/python/tests/nginx.conf @@ -163,12 +163,13 @@ http { server_name workbench2 workbench2.*; ssl_certificate "{{SSLCERT}}"; ssl_certificate_key "{{SSLKEY}}"; - location / { - proxy_pass http://{{LISTENHOST}}:{{WORKBENCH2PORT}}; - proxy_set_header Host $http_host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto https; - proxy_redirect off; + location /config.json { + return 200 '{ "API_HOST": "{{ARVADOS_API_HOST}}" }'; + } + location / { + root /var/lib/arvados/workbench2; + index index.html; + try_files $uri $uri/ /index.html; } } } diff --git a/sdk/python/tests/run_test_server.py b/sdk/python/tests/run_test_server.py index 9c45a32057..9f27510f48 100644 --- a/sdk/python/tests/run_test_server.py +++ b/sdk/python/tests/run_test_server.py @@ -620,6 +620,7 @@ def run_nginx(): nginxconf = {} nginxconf['LISTENHOST'] = 'localhost' nginxconf['CONTROLLERPORT'] = internal_port_from_config("Controller") + nginxconf['ARVADOS_API_HOST'] = "0.0.0.0:" + str(external_port_from_config("Controller")) nginxconf['CONTROLLERSSLPORT'] = external_port_from_config("Controller") nginxconf['KEEPWEBPORT'] = internal_port_from_config("WebDAV") nginxconf['KEEPWEBDLSSLPORT'] = external_port_from_config("WebDAVDownload")