From 812b5b30a141cca0cba43bf3e9b1fb2127cfef4c Mon Sep 17 00:00:00 2001 From: Bastian de Byl Date: Tue, 16 Sep 2025 15:23:29 -0400 Subject: [PATCH] Add CORS support to fulfillr API for local development MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Configure Caddy to send CORS headers for /api/* endpoints - Allow all origins (*) since API is already IP-restricted to local network - Handle preflight OPTIONS requests properly - Update container versions (immich, fulfillr) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- ansible/roles/podman/tasks/main.yml | 6 +++--- .../roles/podman/templates/caddy/Caddyfile.j2 | 21 ++++++++++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ansible/roles/podman/tasks/main.yml b/ansible/roles/podman/tasks/main.yml index b3d1a84..5fdd99f 100644 --- a/ansible/roles/podman/tasks/main.yml +++ b/ansible/roles/podman/tasks/main.yml @@ -49,9 +49,9 @@ - import_tasks: containers/home/photos.yml vars: db_image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0 - ml_image: ghcr.io/immich-app/immich-machine-learning:v1.141.1 + ml_image: ghcr.io/immich-app/immich-machine-learning:v1.142.1 redis_image: docker.io/redis:6.2-alpine@sha256:eaba718fecd1196d88533de7ba49bf903ad33664a92debb24660a922ecd9cac8 - image: ghcr.io/immich-app/immich-server:v1.141.1 + image: ghcr.io/immich-app/immich-server:v1.142.1 tags: photos - import_tasks: containers/home/cloud.yml @@ -68,7 +68,7 @@ - import_tasks: containers/debyltech/fulfillr.yml vars: - image: "{{ aws_ecr_endpoint }}/fulfillr:20250909.2013" + image: "{{ aws_ecr_endpoint }}/fulfillr:20250916.1905" tags: debyltech, fulfillr - import_tasks: containers/home/nosql.yml diff --git a/ansible/roles/podman/templates/caddy/Caddyfile.j2 b/ansible/roles/podman/templates/caddy/Caddyfile.j2 index 656e039..7190247 100644 --- a/ansible/roles/podman/templates/caddy/Caddyfile.j2 +++ b/ansible/roles/podman/templates/caddy/Caddyfile.j2 @@ -198,13 +198,28 @@ # Fulfillr - {{ fulfillr_server_name }} (Static + API with IP restrictions) {{ fulfillr_server_name }} { {{ ip_restricted_site() }} - + @api { path /api/* } - - # Handle API requests + + # Handle API requests with CORS for local development handle @api { + header { + Access-Control-Allow-Origin "*" + Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" + Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With" + Access-Control-Allow-Credentials "true" + } + + # Handle preflight requests + @options { + method OPTIONS + } + handle @options { + respond "" 204 + } + reverse_proxy localhost:9054 }