#!/bin/bash # Deploy queue.workolik.com proxy with CORS support echo "๐Ÿš€ Deploying Queue API Proxy with CORS..." # 1. Start the proxy service echo "๐Ÿ“ฆ Starting queue-api-proxy..." docker compose up -d queue-api-proxy # 2. Wait a moment for it to start sleep 2 # 3. Check if it's running if docker ps | grep -q queue-api-proxy; then echo "โœ… queue-api-proxy is running" else echo "โŒ queue-api-proxy failed to start" docker logs queue-api-proxy exit 1 fi # 4. Test the proxy directly (bypassing Traefik) echo "" echo "๐Ÿงช Testing proxy directly..." curl -X OPTIONS http://localhost:8202/live/api/v1/deliveries/createdeliveries \ -H 'Origin: https://console.nearlexpress.com' \ -H 'Access-Control-Request-Method: POST' \ -v 2>&1 | grep -E "access-control-allow-origin|HTTP/" | head -5 # 5. Test via Traefik (if accessible) echo "" echo "๐Ÿงช Testing via Traefik (HTTPS)..." echo " Run this command to test:" echo " curl -X OPTIONS https://queue.workolik.com/live/api/v1/deliveries/createdeliveries \\" echo " -H 'Origin: https://console.nearlexpress.com' \\" echo " -H 'Access-Control-Request-Method: POST' \\" echo " -v" echo "" echo "โœ… Deployment complete!" echo "" echo "๐Ÿ“‹ If queue.workolik.com was previously routed elsewhere, you may need to:" echo " 1. Remove the old router configuration" echo " 2. Or ensure this new router takes precedence" echo "" echo "๐Ÿ’ก The proxy adds CORS headers and forwards to Kubernetes LoadBalancer (port 8201)"