diff --git a/manifests/web.pp b/manifests/web.pp index 64f2277..ee2515b 100644 --- a/manifests/web.pp +++ b/manifests/web.pp @@ -105,9 +105,9 @@ class zuul::web ( # can query it easily should the need arise. # If the status.json is unavailable for download, no new files are created. if $ssl_cert_file_contents != '' { - $status = "https://${vhost_name}/status" + $status = "https://${vhost_name}/api/status" } else { - $status = "http://${vhost_name}/status" + $status = "http://${vhost_name}/api/status" } cron { 'zuul_scheduler_status_backup': user => 'root', @@ -178,11 +178,7 @@ class zuul::web ( } $web_url = "http://${web_listen_address}:${web_listen_port}" - if ($tenant_name) { - $zuul_web_full_url = "${web_url}/${tenant_name}" - } else { - $zuul_web_full_url = $web_url - } + $websocket_url = "ws://${web_listen_address}:${web_listen_port}" $zuul_web_root = '/opt/zuul-web' $zuul_web_content_root = '/opt/zuul-web/content' $zuul_web_src_root = '/opt/zuul-web/source' diff --git a/templates/zuulv3.vhost.erb b/templates/zuulv3.vhost.erb index 052cbe3..5d35e22 100644 --- a/templates/zuulv3.vhost.erb +++ b/templates/zuulv3.vhost.erb @@ -39,16 +39,27 @@ RewriteRule ^/status - [F] <% end -%> - RewriteRule ^/console-stream <%= @zuul_web_full_url.sub('http://', 'ws://') %>/console-stream [P] - RewriteRule ^/(.*)$ <%= @zuul_web_full_url %>/$1 [P] - RewriteRule ^/$ <%= @zuul_web_full_url %>/status.html [P] + <% if @tenant_name != '' -%> + RewriteRule ^/$ /status.html [L] + # Backwards compat for old status urls. Should be removed in a few weeks. + RewriteRule ^/status$ <%= @web_url %>/api/tenant/<%= @tenant_name %>/status [P] + RewriteRule ^/api/connection/(.*)$ <%= @web_url %>/api/connection/$1 [P] + RewriteRule ^/api/console-stream <%= @websocket_url %>/api/tenant/<%= @tenant_name %>/console-stream [P] + RewriteRule ^/api/(.*)$ <%= @web_url %>/api/tenant/<%= @tenant_name %>/$1 [P] + <% else -%> + RewriteRule ^/$ /tenants.html [L] + RewriteRule ^/t/(.*) /$1 [L] + RewriteRule ^/api/tenant/(.*)/console-stream <%= @websocket_url %>/api/tenant/$1/console-stream [P] + RewriteRule ^/api/(.*)$ <%= @web_url %>/api/$1 [P] + <% end -%> AddOutputFilterByType DEFLATE application/json CacheDefaultExpire 5 - CacheEnable mem /status + # TODO: Should we cache the rest of the API too? + CacheEnable mem /api/status # 12MByte total cache size. MCacheSize 12288 MCacheMaxObjectCount 10 @@ -58,7 +69,7 @@ MCacheMaxStreamingBuffer 8388608 - CacheEnable disk /status + CacheEnable disk /api/status CacheRoot /var/cache/apache2/mod_cache_disk