[Vuejs]-Loading WMS in Vuejs with OpenLayers

1👍

You have a CORS issue (CORS stands for Cross-Origin Resource Sharing). You need to enable CORS on your server.

devServer: {
  ...
  headers: {
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
    "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
  }
}

Some good resources for enabling CORS could be found here:

https://scotch.io/courses/build-an-online-shop-with-vue/enabling-cors

If you have a PHP backend you can just include the following header:

header(“Access-Control-Allow-Origin: *”);
👤Pascut

Leave a comment