Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ligonsker's avatar

Where to place Axios withCredentials value on a Vue CLI app?

I want to send the correct CORS headers one very request when using Axios. In Laravel's docs it says that I need to set axios.defaults.withCredentials = true; in resources/js/bootstrap.js. But right now I have two separate apps: One Vue CLI and one Laravel.

So there is no resources/js/bootstrap.js.

In a Vue CLI app (npm init vue@latest), where should I set axios.defaults.withCredentials = true;?

0 likes
1 reply
aleahy's avatar
aleahy
Best Answer
Level 25

Put it in main.js.

1 like

Please or to participate in this conversation.