upstream skyline { server unix:/var/lib/skyline/skyline.sock fail_timeout=0; } server { listen {{ skyline_bind_address }}:{{ skyline_service_port }}; root {{ skyline_lib_static_files }}; # Add index.php to the list if you are using PHP index index.html; server_name _; error_page 497 http://$http_host$request_uri; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ /index.html; expires 1d; add_header Cache-Control "public"; } location /api/openstack/skyline/ { proxy_pass http://skyline/; proxy_redirect off; proxy_buffering off; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header Host $http_host; } {% for endpoint in openstack_service_endpoints %} {% set _region = endpoint["Region"] | lower %} {% set _type = (endpoint["Service Type"] | lower) %} {% set _url = endpoint["URL"] | urlsplit %} {% if _type in skyline_service_mapping %} {% set _service = skyline_service_mapping[_type] %} location /api/openstack/{{ _region }}/{{ _service }}/ { proxy_pass {{ _url.scheme }}://{{ _url.hostname }}:{{ _url.port }}/; proxy_redirect {{ _url.scheme }}://{{ _url.hostname }}:{{ _url.port }}/ /api/openstack/{{ _region }}/{{ _service }}/; proxy_buffering off; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header Host $http_host; } {% endif %} {% endfor %} }