80 lines
2.6 KiB
Bash
80 lines
2.6 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
# Production Test für api.dragons-at-work.de
|
||
|
|
|
||
|
|
echo "Testing Production API via Apache Proxy"
|
||
|
|
echo "======================================="
|
||
|
|
|
||
|
|
# Test 1: HTTPS Health Check
|
||
|
|
echo ""
|
||
|
|
echo "[1] Testing HTTPS Health Check..."
|
||
|
|
https_health=$(curl -s https://api.dragons-at-work.de/health)
|
||
|
|
echo "HTTPS Response: $https_health"
|
||
|
|
|
||
|
|
if echo "$https_health" | grep -q "healthy"; then
|
||
|
|
echo "[OK] HTTPS Proxy working"
|
||
|
|
else
|
||
|
|
echo "[ERROR] HTTPS Proxy failed"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Test 2: SMTP Status via HTTPS
|
||
|
|
echo ""
|
||
|
|
echo "[2] Testing SMTP Configuration via HTTPS..."
|
||
|
|
if echo "$https_health" | grep -q '"smtp_configured":true'; then
|
||
|
|
echo "[OK] SMTP configured and accessible via HTTPS"
|
||
|
|
else
|
||
|
|
echo "[ERROR] SMTP not configured or not accessible"
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Test 3: CORS Headers
|
||
|
|
echo ""
|
||
|
|
echo "[3] Testing CORS Headers..."
|
||
|
|
cors_test=$(curl -s -I https://api.dragons-at-work.de/health | grep -i "access-control")
|
||
|
|
if [ -n "$cors_test" ]; then
|
||
|
|
echo "[OK] CORS headers present: $cors_test"
|
||
|
|
else
|
||
|
|
echo "[WARN] CORS headers missing - add to Apache config"
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Test 4: Production Mail Test
|
||
|
|
echo ""
|
||
|
|
echo "[4] Testing Production Mail via HTTPS..."
|
||
|
|
echo "WARNING: This sends real email via production API"
|
||
|
|
read -p "Continue with production mail test? (y/N): " -n 1 -r
|
||
|
|
echo
|
||
|
|
|
||
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||
|
|
echo "Sending production test email..."
|
||
|
|
|
||
|
|
prod_mail_response=$(curl -s -X POST https://api.dragons-at-work.de/v1/mail/send \
|
||
|
|
-H "Content-Type: application/json" \
|
||
|
|
-d '{
|
||
|
|
"name": "Production Test",
|
||
|
|
"email": "test@dragons-at-work.de",
|
||
|
|
"subject": "Production API Test - Apache Proxy Success!",
|
||
|
|
"message": "This email was sent via the production API at api.dragons-at-work.de through Apache proxy to Furt-Lua backend. HTTPS integration working!"
|
||
|
|
}')
|
||
|
|
|
||
|
|
echo "Production Response: $prod_mail_response"
|
||
|
|
|
||
|
|
if echo "$prod_mail_response" | grep -q '"success":true'; then
|
||
|
|
echo "[OK] PRODUCTION MAIL SENT VIA HTTPS!"
|
||
|
|
echo "Check admin@dragons-at-work.de for delivery confirmation"
|
||
|
|
else
|
||
|
|
echo "[ERROR] Production mail failed"
|
||
|
|
fi
|
||
|
|
else
|
||
|
|
echo "Skipping production mail test"
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Test 5: Security Headers
|
||
|
|
echo ""
|
||
|
|
echo "[5] Testing Security Headers..."
|
||
|
|
security_headers=$(curl -s -I https://api.dragons-at-work.de/health)
|
||
|
|
echo "Security Headers:"
|
||
|
|
echo "$security_headers" | grep -i "x-content-type-options\|x-frame-options\|strict-transport"
|
||
|
|
|
||
|
|
echo ""
|
||
|
|
echo "Production Test Complete!"
|
||
|
|
echo "========================"
|
||
|
|
echo "Next: Hugo integration with https://api.dragons-at-work.de/v1/mail/send"
|