Skip to content

CORS policy. #45

@GeorgeIvlev

Description

@GeorgeIvlev

Hi! I have a question about making requests from frontend part. As i figured out https://www.tickspot.com/api doesn't return a 'Access-Control-Allow-Origin' header. API working fine if i send CURL request from terminal or use the backend. I want to implement ui on my frontend to be able make requests to API without backend, can you help me please with that question? Thanks!

Here is my code:

fetch('https://www.tickspot.com/api/v2/roles', {
    method: 'GET',
    headers: {
        'Access-Control-Allow-Origin': '*',
        'Content-type': 'application/json',
        'Authorization': 'Basic mytoken',
        'User-Agent': 'MyCoolApp (myemail)'
    }
})
.then(res => {
    if (res.ok)
        return res.json();

    throw new Error('An error has occured: ', res);
})
.catch(err => {
    console.warn(err);
});

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions