<mxfile host="app.diagrams.net"><diagram id="cors-preflight" name="CORS: preflight, then the actual request"><mxGraphModel dx="900" dy="1050" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="900" pageHeight="1050" background="#ffffff"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="shape-0" value="CORS: preflight, then the actual request" style="text;html=0;whiteSpace=wrap;overflow=visible;align=left;verticalAlign=top;spacing=0;fontFamily=Arial;fontSize=27;fontColor=#172b4d;fontStyle=1;" vertex="1" parent="1"><mxGeometry x="36" y="26" width="828" height="26" as="geometry"/></mxCell>
<mxCell id="shape-1" value="The browser checks permission to send a cross-origin DELETE request." style="text;html=0;whiteSpace=wrap;overflow=visible;align=left;verticalAlign=top;spacing=0;fontFamily=Arial;fontSize=18;fontColor=#526176;fontStyle=0;" vertex="1" parent="1"><mxGeometry x="36" y="70" width="828" height="26" as="geometry"/></mxCell>
<mxCell id="shape-2" value="" style="rounded=1;arcSize=12;whiteSpace=wrap;html=0;fillColor=#eff6ff;strokeColor=#1d4ed8;strokeWidth=1.75;dashed=0;" vertex="1" parent="1"><mxGeometry x="60" y="120" width="230" height="78" as="geometry"/></mxCell>
<mxCell id="shape-3" value="Browser" style="text;html=0;whiteSpace=wrap;overflow=visible;align=center;verticalAlign=top;spacing=0;fontFamily=Arial;fontSize=21;fontColor=#172b4d;fontStyle=1;" vertex="1" parent="1"><mxGeometry x="70" y="130" width="210" height="26" as="geometry"/></mxCell>
<mxCell id="shape-4" value="app.example" style="text;html=0;whiteSpace=wrap;overflow=visible;align=center;verticalAlign=top;spacing=0;fontFamily=Arial;fontSize=17;fontColor=#526176;fontStyle=0;" vertex="1" parent="1"><mxGeometry x="70" y="162" width="210" height="26" as="geometry"/></mxCell>
<mxCell id="shape-5" value="" style="rounded=1;arcSize=12;whiteSpace=wrap;html=0;fillColor=#ecfdf5;strokeColor=#047857;strokeWidth=1.75;dashed=0;" vertex="1" parent="1"><mxGeometry x="610" y="120" width="230" height="78" as="geometry"/></mxCell>
<mxCell id="shape-6" value="API server" style="text;html=0;whiteSpace=wrap;overflow=visible;align=center;verticalAlign=top;spacing=0;fontFamily=Arial;fontSize=21;fontColor=#172b4d;fontStyle=1;" vertex="1" parent="1"><mxGeometry x="620" y="130" width="210" height="26" as="geometry"/></mxCell>
<mxCell id="shape-7" value="api.example" style="text;html=0;whiteSpace=wrap;overflow=visible;align=center;verticalAlign=top;spacing=0;fontFamily=Arial;fontSize=17;fontColor=#526176;fontStyle=0;" vertex="1" parent="1"><mxGeometry x="620" y="162" width="210" height="26" as="geometry"/></mxCell>
<mxCell id="shape-8" style="edgeStyle=none;rounded=0;html=0;strokeColor=#64748b;strokeWidth=2.25;endArrow=none;endFill=1;startArrow=none;startFill=1;dashed=1;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="175" y="198" as="sourcePoint"/><mxPoint x="175" y="974" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="shape-9" style="edgeStyle=none;rounded=0;html=0;strokeColor=#64748b;strokeWidth=2.25;endArrow=none;endFill=1;startArrow=none;startFill=1;dashed=1;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="725" y="198" as="sourcePoint"/><mxPoint x="725" y="974" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="shape-10" value="1  Ask before sending DELETE" style="text;html=0;whiteSpace=wrap;overflow=visible;align=left;verticalAlign=top;spacing=0;fontFamily=Arial;fontSize=20;fontColor=#1d4ed8;fontStyle=1;" vertex="1" parent="1"><mxGeometry x="190" y="224" width="520" height="26" as="geometry"/></mxCell>
<mxCell id="shape-11" value="" style="rounded=1;arcSize=12;whiteSpace=wrap;html=0;fillColor=#eff6ff;strokeColor=#1d4ed8;strokeWidth=1.75;dashed=0;" vertex="1" parent="1"><mxGeometry x="190" y="258" width="520" height="99" as="geometry"/></mxCell>
<mxCell id="shape-12" value="OPTIONS /user/123&#xa;Origin: https://app.example&#xa;Access-Control-Request-Method: DELETE" style="text;html=0;whiteSpace=wrap;overflow=visible;align=left;verticalAlign=top;spacing=0;fontFamily=Courier New;fontSize=17;fontColor=#172b4d;fontStyle=0;" vertex="1" parent="1"><mxGeometry x="206" y="270" width="488" height="75" as="geometry"/></mxCell>
<mxCell id="shape-13" style="edgeStyle=none;rounded=0;html=0;strokeColor=#1d4ed8;strokeWidth=2.25;endArrow=block;endFill=1;startArrow=none;startFill=1;dashed=0;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="175" y="375" as="sourcePoint"/><mxPoint x="725" y="375" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="shape-14" value="2  Allow this origin and method" style="text;html=0;whiteSpace=wrap;overflow=visible;align=left;verticalAlign=top;spacing=0;fontFamily=Arial;fontSize=20;fontColor=#047857;fontStyle=1;" vertex="1" parent="1"><mxGeometry x="190" y="424" width="520" height="26" as="geometry"/></mxCell>
<mxCell id="shape-15" value="" style="rounded=1;arcSize=12;whiteSpace=wrap;html=0;fillColor=#ecfdf5;strokeColor=#047857;strokeWidth=1.75;dashed=0;" vertex="1" parent="1"><mxGeometry x="190" y="458" width="520" height="99" as="geometry"/></mxCell>
<mxCell id="shape-16" value="HTTP/1.1 204 No Content&#xa;Access-Control-Allow-Origin: https://app.example&#xa;Access-Control-Allow-Methods: DELETE" style="text;html=0;whiteSpace=wrap;overflow=visible;align=left;verticalAlign=top;spacing=0;fontFamily=Courier New;fontSize=17;fontColor=#172b4d;fontStyle=0;" vertex="1" parent="1"><mxGeometry x="206" y="470" width="488" height="75" as="geometry"/></mxCell>
<mxCell id="shape-17" style="edgeStyle=none;rounded=0;html=0;strokeColor=#047857;strokeWidth=2.25;endArrow=block;endFill=1;startArrow=none;startFill=1;dashed=0;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="725" y="575" as="sourcePoint"/><mxPoint x="175" y="575" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="shape-18" value="3  Send the actual request" style="text;html=0;whiteSpace=wrap;overflow=visible;align=left;verticalAlign=top;spacing=0;fontFamily=Arial;fontSize=20;fontColor=#1d4ed8;fontStyle=1;" vertex="1" parent="1"><mxGeometry x="190" y="650" width="520" height="26" as="geometry"/></mxCell>
<mxCell id="shape-19" value="" style="rounded=1;arcSize=12;whiteSpace=wrap;html=0;fillColor=#eff6ff;strokeColor=#1d4ed8;strokeWidth=1.75;dashed=0;" vertex="1" parent="1"><mxGeometry x="190" y="684" width="520" height="74" as="geometry"/></mxCell>
<mxCell id="shape-20" value="DELETE /user/123&#xa;Origin: https://app.example" style="text;html=0;whiteSpace=wrap;overflow=visible;align=left;verticalAlign=top;spacing=0;fontFamily=Courier New;fontSize=17;fontColor=#172b4d;fontStyle=0;" vertex="1" parent="1"><mxGeometry x="206" y="696" width="488" height="50" as="geometry"/></mxCell>
<mxCell id="shape-21" style="edgeStyle=none;rounded=0;html=0;strokeColor=#1d4ed8;strokeWidth=2.25;endArrow=block;endFill=1;startArrow=none;startFill=1;dashed=0;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="175" y="776" as="sourcePoint"/><mxPoint x="725" y="776" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="shape-22" value="4  Return the actual response" style="text;html=0;whiteSpace=wrap;overflow=visible;align=left;verticalAlign=top;spacing=0;fontFamily=Arial;fontSize=20;fontColor=#047857;fontStyle=1;" vertex="1" parent="1"><mxGeometry x="190" y="824" width="520" height="26" as="geometry"/></mxCell>
<mxCell id="shape-23" value="" style="rounded=1;arcSize=12;whiteSpace=wrap;html=0;fillColor=#ecfdf5;strokeColor=#047857;strokeWidth=1.75;dashed=0;" vertex="1" parent="1"><mxGeometry x="190" y="858" width="520" height="74" as="geometry"/></mxCell>
<mxCell id="shape-24" value="HTTP/1.1 204 No Content&#xa;Access-Control-Allow-Origin: https://app.example" style="text;html=0;whiteSpace=wrap;overflow=visible;align=left;verticalAlign=top;spacing=0;fontFamily=Courier New;fontSize=17;fontColor=#172b4d;fontStyle=0;" vertex="1" parent="1"><mxGeometry x="206" y="870" width="488" height="50" as="geometry"/></mxCell>
<mxCell id="shape-25" style="edgeStyle=none;rounded=0;html=0;strokeColor=#047857;strokeWidth=2.25;endArrow=block;endFill=1;startArrow=none;startFill=1;dashed=0;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="725" y="950" as="sourcePoint"/><mxPoint x="175" y="950" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="shape-26" style="edgeStyle=none;rounded=0;html=0;strokeColor=#cbd5e1;strokeWidth=1;endArrow=none;endFill=1;startArrow=none;startFill=1;dashed=0;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="36" y="993" as="sourcePoint"/><mxPoint x="864" y="993" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="shape-27" value="No credentials in this example. CORS does not replace server-side authentication or authorization." style="text;html=0;whiteSpace=wrap;overflow=visible;align=left;verticalAlign=top;spacing=0;fontFamily=Arial;fontSize=16;fontColor=#526176;fontStyle=0;" vertex="1" parent="1"><mxGeometry x="36" y="1008" width="828" height="26" as="geometry"/></mxCell></root></mxGraphModel></diagram></mxfile>
