cors

How to Enable CORS for an AWS API Gateway Resource

▼魔方 西西 提交于 2019-12-23 19:40:22
问题 I created REST API using AWS API Gateway & AWS Lambda and when I configured CORS I faced with such issue - I was able to configure CORS response headers for OPTIONS method, but didn't for GET method. I made it according Amazon documentation, but when I called GET method I didn't see required headers (Access-Control-Allow-Methods, Access-Control-Allow-Headers, Access-Control-Allow-Origin) in response. Due to that I got errors on client side: Failed to load #my_test_rest#: No 'Access-Control

What to do when an API doesn't allow Access-Control-Allow-Origin

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 18:56:37
问题 I'm driving crazy with all this same-origin-policy thing. When I try to do a request to the Google Maps API I have no problems: var jsonData = $.ajax({ url:"http://maps.googleapis.com/maps/api/geocode/json?address=", dataType:"json", async:true, success: function(json){...} } I think that is because Google Maps API allow Access-Control-Allow-Origin. But when I try to use the openls.geog.uni-heidelberg.de API I get the cross-origin error: var xmlData = $.ajax({ type: "GET", url:"http://openls

Font from origin has been blocked in ASP MVC

喜欢而已 提交于 2019-12-23 17:43:31
问题 I put font references to sub domain and I using that like this: <link href="https://cdn.example.com/Styles/font-awesome.min.css" rel="stylesheet" /> Font from origin 'https://cdn.example.com' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://example.com' is therefore not allowed access. I found a solution but it doesn't help me, I think the reason is I use https instead of http .

Access-Control-Allow-Origin with Wikipedia API with Javascript

▼魔方 西西 提交于 2019-12-23 16:50:46
问题 Trying to receive a response from the Wikipedia API on Codepen. The reply should be a json which i'm trying to console.log. In the console however I see an error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://en.wikipedia.org/w/api.php?action=opensearch&search=earth&format=json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). I've read quite a bit over the past few days about CORS and Allow-Origin to try to understand but

Inserting link tag with integrity and crossorigin attribute issue

☆樱花仙子☆ 提交于 2019-12-23 16:32:24
问题 Trying to insert css document with Javascript, however I receive error saying that request has to be CORS enabled. Is there a way to deal with it? Here is the code: var link = document.createElement('link'); link.rel = 'stylesheet'; link.href = 'https://use.fontawesome.com/releases/v5.2.0/css/all.css'; link.integrity = 'sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ'; link.crossorigin = 'anonymous'; document.head.appendChild(link); 回答1: Change crossorigin (not a valid

No Access-Control-Allow-Origin error in Meteor app

社会主义新天地 提交于 2019-12-23 15:52:22
问题 I added CORS extension to chrome. When called ajax from localhost I got response in the form of XML. If I disabled CORS extension I got the following error. I referred so many questions in this community. But I cant't resolve my problem. It may duplicate but I'm asking this question for help with hope. XMLHttpRequest cannot load https://buzz.machaao.com/feed. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested

CORS and ASP.Net Web API

非 Y 不嫁゛ 提交于 2019-12-23 15:52:08
问题 I am attempting to get CORS set up in an asp.net web api. My WebApiConfig.cs is: using System; using System.Collections.Generic; using System.Linq; using System.Web.Http; using System.Web.Http.Controllers; using System.Web.Http.Cors; using System.Web.Http.Routing; namespace WebApplication2 { public static class WebApiConfig { public static void Register(HttpConfiguration config) { config.MapHttpAttributeRoutes(); var cors = new EnableCorsAttribute("http://localhost", "*", "*"); config

Error while trying to access public stories from Medium API on client side

时间秒杀一切 提交于 2019-12-23 15:44:50
问题 I'm trying to access Medium's API to get a list of public stories from a user. However, I'm getting a CORS error when I try to access it on the client side. Here's the code axios.get(`http://medium.com/@ev/latest`).then((res)=>{ console.log(res.data) }) .catch((error)=>{ console.log(error) }) I did some research and found this github issue, but couldn't find any workaround. Is there any way to make this request work on the client side? 回答1: You can get the HTML from https://medium.com/@ev

ASP .NET Core use multiple CORS policies

╄→гoц情女王★ 提交于 2019-12-23 15:44:34
问题 I am trying to setup 2 CORS policies. One as an api default and the other to use on Controllers as I need them. The reason I want to do this is because I have an endpoint that takes in an object with email info and sends an email (to use with the contact me box on my webpage) and have it only accept requests from my domain. My startup.cs file snippet: public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy("Example", builder => builder

How to set CORS headers into internal server error responses?

邮差的信 提交于 2019-12-23 14:42:08
问题 I have a java application server with a REST interface provided by resteasy and I have the CORS filter bellow @Provider public class CORSFilter implements ContainerResponseFilter { public void filter(ContainerRequestContext cReq, ContainerResponseContext cResp) { cResp.getHeaders().add("Access-Control-Allow-Origin", "*"); cResp.getHeaders().add("Access-Control-Allow-Headers", "origin, content-type, accept, authorization, auth-token"); cResp.getHeaders().add("Access-Control-Allow-Credentials",