3 ms·
Is there a way one can make a JS fetch() call and instruct browser to not send cookies etc, so CORS limitation won't be applied? CORS is basically happening be
by rk06 2y ago
Is there a way one can make a JS fetch() call and instruct browser to not send cookies etc, so CORS limitation won't be applied?
CORS is basically happening because of the sensitive data that browser sends by default, so if browser is not sending such info, then CORS also need not be applied
- robertlagrant 2y ago> CORS is basically happening because of the sensitive data that browser sends by default, so if browser is not sending such info, then CORS also need not be applied Can you cite where this behaviour is defined?
- deleted 2y ago[deleted]
- rk06 2y agoI am just asking if there is a way around it. I know CORS is in palce due to browser sending cookie and auth info by default with HTTP requests. other poster mentioned that fetch does have this behavior, but I have not seen if such requests will be blocked by CORS or not
- robertlagrant 2y agoAh okay. It didn't appear to be a question at all. In that case, I'd say yes that might well make sense. CORS is a bit of a cudgel.
- 63stack 2y agoThe default is quite the opposite. Whether fetch sends credentials is controlled by the 'credentials' option, which defaults to "same-origin". https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#including_credentials https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/U...