Skip to content

Commit

Permalink
Merge pull request #203 from orbs-network/fix_xginx_config
Browse files Browse the repository at this point in the history
support accessing status files with CORS
  • Loading branch information
itamararjuan authored Aug 4, 2021
2 parents 069a0a6 + 2d0ceca commit b369442
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 118 deletions.
22 changes: 11 additions & 11 deletions boyar/nginx_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ location @error404 { return 404 '{{DefaultResponse "Not found"}}'; }
location @error502 { return 502 '{{DefaultResponse "Bad gateway"}}'; }
{{- range .Chains }}
set $vc{{.Id}} {{.ServiceId}};
location ~ ^/vchains/{{.Id}}/logs/(.*) {
alias {{.LogsVolume}}/$1;
location ~ ^/vchains/{{.Id}}/logs/(?<filename>.*) {
alias {{.LogsVolume}}/$filename;
error_page 404 = @error404;
error_page 403 = @error403;
}
Expand All @@ -64,8 +64,8 @@ location ~ ^/vchains/{{.Id}}/logs$ {
error_page 404 = @error404;
error_page 403 = @error403;
}
location ~ ^/vchains/{{.Id}}/status/(.*) {
alias {{.StatusVolume}}/$1;
location ~ ^/vchains/{{.Id}}/status/(?<filename>.*) {
alias {{.StatusVolume}}/$filename;
error_page 404 = @error404;
error_page 403 = @error403;
}
Expand All @@ -75,14 +75,14 @@ location ~ ^/vchains/{{.Id}}/status$ {
error_page 404 = @error404;
error_page 403 = @error403;
}
location ~ ^/vchains/{{.Id}}(/?)(.*) {
proxy_pass http://$vc{{.Id}}:{{.Port}}/$2$is_args$args;
location ~ ^/vchains/{{.Id}}(/?)(?<filename>.*) {
proxy_pass http://$vc{{.Id}}:{{.Port}}/$filename$is_args$args;
error_page 502 = @error502;
}
{{- end }} {{- /* range .Chains */ -}}
{{- range .Services }}
location ~ ^/services/{{.ServiceId}}/logs/(.*) {
alias {{.LogsVolume}}/$1;
location ~ ^/services/{{.ServiceId}}/logs/(?<filename>.*) {
alias {{.LogsVolume}}/$filename;
error_page 404 = @error404;
error_page 403 = @error403;
}
Expand All @@ -91,9 +91,9 @@ location ~ ^/services/{{.ServiceId}}/logs$ {
error_page 404 = @error404;
error_page 403 = @error403;
}
location ~ ^/services/{{.ServiceId}}/status/(.*) {
location ~ ^/services/{{.ServiceId}}/status/(?<filename>.*) {
{{ CORS }}
alias {{.StatusVolume}}/$1;
alias {{.StatusVolume}}/$filename;
error_page 404 = @error404;
error_page 403 = @error403;
}
Expand Down Expand Up @@ -175,7 +175,7 @@ func getCORS() string {
# CORS start
# Simple requests
if ($request_method ~* "(GET|POST)") {
if ($request_method ~* "GET|POST") {
add_header "Access-Control-Allow-Origin" *;
}
Expand Down
Loading

0 comments on commit b369442

Please sign in to comment.