48 lines
1.5 KiB
Bash
48 lines
1.5 KiB
Bash
#!/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)"
|
|
|