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

Walker's avatar

Axios

Hi guys, I'm trying an axios call on an external api. I can't deal with cors. I'm getting a Referrer Policy error: strict-origin-when-cross-origin. Can you advise?

axios.get(
            'https://datahub.ekosystem.slovensko.digital/api/datahub/corporate_bodies/search?q=cin:' + inputValue + '&expand=rpo_organizations', {
            method: 'GET',
            mode: 'no-cors',
            headers: {
                'Access-Control-Allow-Origin': '*',
                'Content-Type': 'application/json',
                'Authorization': `token ${access_token}`
            },
            withCredentials: true,
            credentials: 'same-origin',
        })
0 likes
5 replies
jlrdw's avatar

Have you tried changing your cors config settings. Of course do a config:clear afterwards.

Walker's avatar

I tried it like this but I don't know if it's right. I also installed the fruitcake package/ laravel-cors

'paths' => ['api/*', 'sanctum/csrf-cookie', '*'],

    'allowed_methods' => ['*'],

    'allowed_origins' => ['*'],

    'allowed_origins_patterns' => ['*'],

    'allowed_headers' => ['*'],

    'exposed_headers' => ['*'],

    'max_age' => 0,

    'supports_credentials' => true,
jlrdw's avatar

The external API should have some instructions to follow as to how to get their data I would say double check their documentation first.

Walker's avatar

Hi, he didn't come ... I made a livewire component and I'm pulling a classic http request.

Please or to participate in this conversation.