| server { |
| ${LISTENER} |
| server_name localhost; |
| absolute_redirect off; |
| client_max_body_size 20m; |
| |
| ${SERVER_CONF} |
| |
| root /usr/share/nginx/html; |
| |
| location = / { |
| add_header Cache-Control no-cache; |
| expires 0; |
| try_files /index.html =404; |
| } |
| |
| location / { |
| try_files $uri /index.html; |
| } |
| |
| location /api/ { |
| resolver ${DNS} valid=${DNS_VALID}; |
| resolver_timeout 3s; |
| set $target "${DEVLAKE_ENDPOINT}"; |
| rewrite ^ $request_uri; |
| rewrite ^/api/(.*) $1 break; |
| return 400; |
| proxy_send_timeout 60s; |
| proxy_read_timeout 60s; |
| proxy_pass ${DEVLAKE_ENDPOINT_PROTO}://$target/$uri; |
| proxy_http_version 1.1; |
| proxy_set_header "Connection" ""; |
| } |
| |
| location /api/rest/ { |
| auth_basic off; |
| resolver ${DNS} valid=${DNS_VALID}; |
| resolver_timeout 3s; |
| set $target "${DEVLAKE_ENDPOINT}"; |
| rewrite /api/(.*) /$1 break; |
| proxy_send_timeout 60s; |
| proxy_read_timeout 60s; |
| proxy_pass ${DEVLAKE_ENDPOINT_PROTO}://$target; |
| proxy_http_version 1.1; |
| proxy_set_header "Connection" ""; |
| } |
| |
| location /grafana/ { |
| auth_basic off; |
| set $external "${USE_EXTERNAL_GRAFANA}"; |
| if ($external = "true") { |
| return 302 "${GRAFANA_ENDPOINT}"; |
| } |
| resolver ${DNS} valid=${DNS_VALID}; |
| resolver_timeout 3s; |
| set $target "${GRAFANA_ENDPOINT}"; |
| proxy_set_header Host $http_host; |
| proxy_set_header Authorization ""; |
| proxy_set_header X-Forwarded-Access-Token "${cookie_access_token}"; |
| proxy_send_timeout 60s; |
| proxy_read_timeout 60s; |
| proxy_pass ${GRAFANA_ENDPOINT_PROTO}://$target; |
| proxy_http_version 1.1; |
| proxy_set_header "Connection" ""; |
| } |
| |
| location /health/ { |
| auth_basic off; |
| return 200; |
| } |
| |
| location /health { |
| auth_basic off; |
| return 200; |
| } |
| |
| } |