#!/usr/bin/env bash
# Diagnostiziert ausschließlich öffentlich sichtbare HTTP-Header; keine Zugangsdaten.
set -euo pipefail
API="https://api.wetslip.net"
ORIGIN="https://m.wetslip.net"
echo '== CORS Preflight auf /mobile/auth/login =='
curl --max-time 12 -sSi -X OPTIONS "$API/mobile/auth/login" \
 -H "Origin: $ORIGIN" \
 -H 'Access-Control-Request-Method: POST' \
 -H 'Access-Control-Request-Headers: content-type,x-csrf-token' \
 | grep -iE '^(HTTP/|access-control-|vary:|location:|content-type:)' || true
echo
 echo '== Gastzugriff /mobile/auth/me (erwartet: 401 mit CORS Header) =='
curl --max-time 12 -sSi "$API/mobile/auth/me" -H "Origin: $ORIGIN" -H 'Accept: application/json' \
 | grep -iE '^(HTTP/|access-control-|vary:|location:|content-type:)' || true
