Git Product home page Git Product logo

Comments (3)

jiangyoucai avatar jiangyoucai commented on May 29, 2024

不仅上传图片
rest api 发出跨域请求,像post,put,delete,options
同样也会出这个错

解决跨域问题,最优方案

修改后端配置

一段golang代码,仅供参考

w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")

from vue-editor.

lanbaba avatar lanbaba commented on May 29, 2024

谢谢提供的解决方案,关键是我打算浏览器直传阿里云,不经过我们自己的的服务器,所以服务器返回的Header无法控制,只能修改客户端代码。
阿里云oss返回Header:
Access-Control-Allow-Methods:GET, POST, PUT, DELETE, HEAD
Access-Control-Allow-Origin:*

from vue-editor.

lanbaba avatar lanbaba commented on May 29, 2024

阿里云服务器端可配置限定域名上传

from vue-editor.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.