wuxt icon indicating copy to clipboard operation
wuxt copied to clipboard

Origin is not allowed by Access-Control-Allow-Origin

Open Ansonhkg opened this issue 5 years ago • 2 comments

All the containers are running. Followed the tutorial and applied wuxt theme, enabled post. When I go to the frontend http://localhost:3000/sample-page it shows

Request has been terminated Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc. An error occurred while rendering the page. Check developer tools console for details.

When I look at the console, it says: Access to XMLHttpRequest at 'http://localhost:3080/wp-json/wuxt/v1/slug/sample-page' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

sample-page:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)

image

Ansonhkg avatar Jun 04 '19 19:06 Ansonhkg

@Ansonhkg You need to enable pretty permalinks for it to work. This is a common wordpress issue with the api.

patsa avatar Aug 08 '19 14:08 patsa

@patsa HI, I deleted a post for this issue I was wrong, I tried to get menu list, but I was using the name which I created in wordpress, but it seems that I have to use "main" to get the list and add then for the promise to get response. Please is there a documentation how we can use api with nuxt?

MaherSoua avatar Nov 03 '19 14:11 MaherSoua