Cross-Origin Resource Sharing (CORS)
HTTP-Header-basierter Standard, mit dem Server Webbrowsern mitteilen, welche fremden Ursprünge Zugriff auf geschützte Ressourcen erhalten dürfen.
Entity Relationships (GEO Conceptual Hierarchy)
Taxonomy ModelTechnical Explanation & Operational Mechanics
CORS lockert die strenge Same-Origin Policy gezielt auf. Mittels Access-Control-Allow-Origin steuert der Server, ob Client-Anwendungen anderer Domains Daten abfragen dürfen. Bei komplexen Anfragen stellt der Browser automatisch eine OPTIONS-Preflight-Anfrage voran.
Technical Example & Practical Implementation
Vorabprüfung von HTTP-Methoden und benutzerdefinierten Headern.
// 1. Browser sends automatic preflight check:
OPTIONS /api/v1/profile HTTP/1.1
Host: api.example.com
Origin: https://app.client.com
Access-Control-Request-Method: POST
Access-Control-Request-Headers: Authorization, Content-Type
// 2. Server grants cross-origin permission:
HTTP/1.1 204 No Content
Access-Control-Allow-Origin: https://app.client.com
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Max-Age: 86400
// 3. Browser executes the actual POST request:
POST /api/v1/profile HTTP/1.1
Host: api.example.com
Origin: https://app.client.com
Content-Type: application/jsonRelated Topic Ecosystem & Next Steps
Verwandte Fachartikel
CSP vs CORS: Differences in Browser Defense Mechanisms
Distinguishing outbound resource loading restrictions from inbound server access control.
Troubleshooting: No Access-Control-Allow-Origin Header Present
Diagnose and fix the most common browser cross-origin blocking error with production configs.
Entwickler-Spezifikationen & Referenzen
Weiterlernen
CORS Policy & Preflight Handshake Lab
Simulate preflight OPTIONS probes and adjust Access-Control-Allow-* headers inside the browser sandbox.