![](/img/trans.png)
[英]Delete file doesn't work with cors but upload works with cors with AWS S3 bucket
[英]Chrome's plugin CORS Toggle doesn't work using POST/PUT/DELETE method
我已經解決了問題: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'file://' is therefore not allowed access
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'file://' is therefore not allowed access
,這是CORS的問題,我解決了安裝Chrome的“ CORS Toggle”插件的問題,但僅適用於GET方法。 實際上,當我運行anguarjs http文件並且嘗試使用其他方法(例如PUT)時,Chrome的控制台會顯示此錯誤: Method PUT is not allowed by Access-Control-Allow-Methods in preflight response.
。 我認為該插件沒有所有CORS許可。 有人可以幫助我嗎?
刪除插件。 嘗試在您的web.xml文件中添加以下行:
<filter> <filter-name>CorsFilter</filter-name> <filter-class>org.apache.catalina.filters.CorsFilter</filter-class> <init-param> <param-name>cors.allowed.origins</param-name> <param-value>*</param-value> </init-param> <init-param> <param-name>cors.allowed.methods</param-name> <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value> </init-param> </filter> <filter-mapping>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.