0

I need to read a csv data file directly from github in my Vue app (in development mode),

 datal() {
      const data = d3.csv("https://raw.githubusercontent.com/example/examples.csv")
      }

but I have a Preflight Did Not Succeed Error.

Any ideas?

thanks, F

I tried to set the vue.config.js file, but it doesn't work:

module.exports = {
  devServer: {
    host: "0.0.0.0",
    port: 8070,
    compress: true,
    headers: { "Access-Control-Allow-Origin": "*" },
    proxy: {
      "^https://raw.githubusercontent.com": {
        target: "https://raw.githubusercontent.com",
        changeOrigin: true,
        ws: true,
        headers: {
          "Content-Type": "application/text;charset=UTF-8",
          "Access-Control-Allow-Origin": "https://raw.githubusercontent.com"
        }
      }
    }
  },

  • Read up on CORS. You’ve been blocked by GitHub. Probably to stop precisely what you’re trying to do. There’s nothing you can do on your side. – Martin Bean Feb 16 '23 at 16:39
  • If you want to use the Vue Devserver proxy, then you have to make the request to the proxy (e.g. `d3.csv("/example/examples.csv")` … but then you'll need to implement similar proxy functionality on your production server too. – Quentin Feb 16 '23 at 16:44
  • The problem exits only under vue (in development mode) and node.js. The file on github is accessible by javascript in a static html page – Francesco Amato Feb 16 '23 at 17:07

0 Answers0