Skip to content

Commit

Permalink
Resolve cors configuration in fly
Browse files Browse the repository at this point in the history
  • Loading branch information
sehyun-hwang committed Sep 10, 2023
1 parent 11d6601 commit 7c9e002
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ services:
stream:
image: ${CONTAINER_REGISTRY-ghcr.io/sehyun-hwang}/imshow-nginx:${TAG:-latest}
build: nginx
command:
- sh
- -c
- >
sed -i 's/listen 80/listen 80;listen [::]:80/' /etc/nginx/nginx.conf
&& /usr/local/nginx/sbin/nginx -c /etc/nginx/nginx.conf
depends_on:
- express
ports:
Expand Down
8 changes: 6 additions & 2 deletions fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ kill_signal = "SIGINT"
kill_timeout = 5
primary_region = "nrt"

http_options = { response = { headers = { "Access-Control-Allow-Origin" = "https://sehyun-hwang.github.io" } } }

[build]
image = "ghcr.io/sehyun-hwang/imshow-express:fly-initial"

[env]
NGINX_HOST = imshow-nginx.internal
NGINX_HOST = "imshow-nginx.internal"

[[services]]
protocol = "tcp"
internal_port = 80
processes = ["app"]


[[services.ports]]
port = 80
handlers = ["http"]
Expand All @@ -26,7 +26,11 @@ http_options = { response = { headers = { "Access-Control-Allow-Origin" = "https
[[services.ports]]
port = 443
handlers = ["tls", "http"]

[services.concurrency]
type = "connections"
hard_limit = 25
soft_limit = 20

[services.ports.http_options.response.headers]
Access-Control-Allow-Origin = "https://sehyun-hwang.github.io"
22 changes: 22 additions & 0 deletions nginx/fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# fly.toml app configuration file generated for imshow-nginx on 2023-08-07T15:21:45Z
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "imshow-nginx"
primary_region = "nrt"

[build]
image = "shurco/nginx-push-stream-module"

[http_service]
internal_port = 80
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]


[experimental]
cmd = [ "sh", "-c", "sed -i 's/listen 80/listen 80;listen [::]:80/' /etc/nginx/nginx.conf && /usr/local/nginx/sbin/nginx -c /etc/nginx/nginx.conf" ]

0 comments on commit 7c9e002

Please sign in to comment.