From 2f0d63a90fb422454dbad28996d4c2c52929da90 Mon Sep 17 00:00:00 2001 From: Felipe Cotti Date: Wed, 30 Oct 2024 00:13:08 -0300 Subject: [PATCH] Fix Headers! Actually, fix the whole CORS policy. And add the image from the hub to the public docker-compose file. --- build/docker-compose.public.yml | 4 +--- src/Guestbooky/Guestbooky.API/Program.cs | 7 ++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/build/docker-compose.public.yml b/build/docker-compose.public.yml index 225e0eb..31605f0 100644 --- a/build/docker-compose.public.yml +++ b/build/docker-compose.public.yml @@ -1,9 +1,7 @@ services: guestbooky-be: - build: - context: ../ - dockerfile: build/guestbooky-be/Dockerfile + image: cotti/guestbooky-be container_name: guestbooky-be ports: - "8080:8080" diff --git a/src/Guestbooky/Guestbooky.API/Program.cs b/src/Guestbooky/Guestbooky.API/Program.cs index d23ef8e..c804c51 100644 --- a/src/Guestbooky/Guestbooky.API/Program.cs +++ b/src/Guestbooky/Guestbooky.API/Program.cs @@ -74,9 +74,10 @@ namespace Guestbooky.API var corsOrigins = builder.Configuration[Constants.CORS_ORIGINS]?.Split(',') ?? Array.Empty(); cfg.AddPolicy(name: "local", policy => { - policy.WithOrigins(corsOrigins); - policy.AllowAnyHeader(); - policy.AllowAnyMethod(); + policy.WithExposedHeaders("Content-Range", "Accept-Ranges") + .WithOrigins(corsOrigins) + .AllowAnyHeader() + .WithMethods("GET", "POST", "DELETE", "OPTIONS"); }); });