Skip to content

Commit

Permalink
Add CORS headers to Caddyfiles needed for https://soundscape-communit…
Browse files Browse the repository at this point in the history
  • Loading branch information
steinbro authored Dec 8, 2023
1 parent 5ba74d3 commit ece257d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions svcs/data/caddy/Caddyfile.blue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,22 @@
# configuration. The only difference between the two configurations is the port
# number to forward the request to, 8081 for blue and 8082 for green.

(cors) {
@origin{args.0} header Origin {args.0}
header @origin{args.0} Access-Control-Allow-Origin "{args.0}"
header @origin{args.0} Vary Origin
}

tiles.soundscape.services {
reverse_proxy localhost:8081 {
header_up X-Real-IP {remote_host}
}
header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
header Access-Control-Allow-Methods "GET"
header Access-Control-Allow-Headers "*"

# Allow requests coming from the Soundscape web client hosted on Github
import cors https://soundscape-community.github.io
}

newprod0.openscape.io {
Expand Down
11 changes: 11 additions & 0 deletions svcs/data/caddy/Caddyfile.green
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,22 @@
# configuration. The only difference between the two configurations is the port
# number to forward the request to, 8081 for blue and 8082 for green.

(cors) {
@origin{args.0} header Origin {args.0}
header @origin{args.0} Access-Control-Allow-Origin "{args.0}"
header @origin{args.0} Vary Origin
}

tiles.soundscape.services {
reverse_proxy localhost:8082 {
header_up X-Real-IP {remote_host}
}
header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
header Access-Control-Allow-Methods "GET"
header Access-Control-Allow-Headers "*"

# Allow requests coming from the Soundscape web client hosted on Github
import cors https://soundscape-community.github.io
}

newprod0.openscape.io {
Expand Down

0 comments on commit ece257d

Please sign in to comment.