@bigweld86 can you please share your api.php file content? What's different between the routes?
Do you have your APP_URL=http://127.0.0.1:8000 within your .env file?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi.
From my Vue frontend I'm executing a GET request using axios:
axios.get(`http://127.0.0.1:8000/api/categories/list?page=1&items-per-page=100&sort-by=asc&fields=id,name`)
.then(response => {
// eslint-disable-next-line no-console
console.log(response);
//resolve()
})
.catch(errors => {
// eslint-disable-next-line no-console
console.log(errors)
//reject()
})
and I'm getting the following message:
Access to XMLHttpRequest at 'http://127.0.0.1:8000/api/categories/list?page=1&items-per-page=100&sort-by=asc&fields=id,name' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I already have in place a CORS middleware in my Laravel backend, and so far all requests such as:
axios.get(`http://127.0.0.1:8000/api/categories/${this.id}`)
.then(response => {
this.category = response.data.data[0];
// eslint-disable-next-line no-console
console.log(this.category);
})
.catch(errors => {
// eslint-disable-next-line no-console
console.log(errors)
})
or
axios.get(`http://127.0.0.1:8000/api/categories/list?page=${page}&items-per-page=${rowsPerPage}`)
.then(response => {
this.items = this.massageData(response.data.data.data);
this.options = response.data.data.pagination;
this.totalItems = response.data.data.options.totalItems;
this.loading = false
resolve()
})
.catch(errors => {
// eslint-disable-next-line no-console
console.log(errors)
reject()
})
are working correctly.
This is the only request (at the moment) in which I'm passing query parameters and it's the only one failing.
Any ideas?
Please or to participate in this conversation.