Launching Chrome/Firefox from VSCode Debugger (runs in DevTools mode) always gives CORS error for API request, but works fine in normal Firefox/Chrome browser.
Using Laravel for API with CORS enabled. Nextjs (React) for frontend, my api request https://site.test/api/info from the frontend https://localhost:3000/home works fine when using Firefox/Chrome normally.
However, as soon as I use the VSCode Debugger (with Firefox Debugger extension installed), it would give a CORS error in the console.
launch.json (For VS Code Debugger)
"version": "0.2.0",
"configurations": [
{
"type": "firefox",
"request": "launch",
"name": "Launch Firefox against localhost",
"url": "https://localhost:3000/home",
"webRoot": "${workspaceFolder}",
"pathMappings": [
{
"url": "webpack://_n_e",
"path": "${workspaceFolder}"
}
]
}
]
}
Firefox DevTools mode CORS error
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://site.test/api/info. (Reason: CORS request did not succeed). Status code: (null)
Does anyone know how to fix this? Not being able to access the debugger and breakpoints ain't fun.