<p>So the problem is that the browser makes a CORS enabled request to the API with <code>Origin: a</code> and the response has an ETag value is marked as privately cacheable and dependent on the origin (<code>Vary: Origin</code>) and has <code>Access-Control-Allow-Origin: a</code> to match the request.</p>

<p>When the browser makes the second request it sees the <code>Vary: Origin</code> and tries to revalidate using the new <code>Origin: b</code> header and the server says <code>304 nothing changed here</code> but the browser reuses the old cached <code>Access-Control-Allow-Origin</code> rather than the new one the server sent for the new origin.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href='https://github.com/openstreetmap/openstreetmap-website/issues/220#issuecomment-15409176'>view it on GitHub</a>.<img src='https://github.com/notifications/beacon/uTRSc6ihLa7Shf84BpiOpmiconwesGYqAyExYtTePLUNaPJ6HMPcMrOBBZRI6ecM.gif' height='1' width='1'></p>