cors

CORS impossible on AWS Lambda HTTP API Gateway Integration

China☆狼群 提交于 2020-04-28 19:04:20
问题 An AWS Lamba function (NodeJS) returning 3 HTTP headers: aaa, Access-Control-Allow-Origin and bbb was created: exports.handler = async (event) => { const response = { statusCode: 200, headers: { "aaa":"aaa", "Access-Control-Allow-Origin":"*", "bbb":"bbb" }, body: JSON.stringify('Hello from Lambda!'), }; return response; }; The function is integrated into a HTTP API (not REST API). In the HTTP API Gateway Configuration, Section "Configure CORS", the HTTP header "Access-Control-Allow-Origin"

Getting data with Meetups API javascript

爷,独闯天下 提交于 2020-04-16 05:14:14
问题 I'm trying to use meetups API with an API key, but I'm being blocked by CORS. I'm using the example meetup gives: https://api.meetup.com/2/events?key=mykey&group_urlname=ny-tech&sign=true , replacing the API key with my API key. This example comes from here. Here's my code (I took out my key and replaced it with < key>): <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <button id="find">find</button> <script> $("#find").click( function(){ $.getJSON(

Puppeteer cors mistake

强颜欢笑 提交于 2020-04-16 03:05:10
问题 hello i have problem in my code using puppeteer, cors error happens randomly but in 80% of my tests. Here is my code thanks for help.Btw the server respond is Access to fetch at 'https://secure-store.nike.com/eu/services/jcartService/?action=addItem&rt=json&country=GB&region=eu&lang_locale=en_GB&catalogId=1&productId=12238990&qty=1&skuId=21502246' from origin 'https://www.nike.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Using Fetch API to POST XML

。_饼干妹妹 提交于 2020-04-13 05:09:22
问题 I'm trying to use Fetch API to handle POST of XML data to avoid cross-origin issues with XmlHttpRequest. The issue I face is that despite setting my Content-Type to 'text/xml' (which is the only supported content-type header in this case) my request's content-type is being reset to text/plain resulting in a HTTP status of 415 from the requested content. Here is my fetch function: function doFetch(Content) { return fetch( URL, { method: 'POST', mode: 'no-cors', headers: new Headers( {'Content

Using Fetch API to POST XML

不羁岁月 提交于 2020-04-13 05:09:06
问题 I'm trying to use Fetch API to handle POST of XML data to avoid cross-origin issues with XmlHttpRequest. The issue I face is that despite setting my Content-Type to 'text/xml' (which is the only supported content-type header in this case) my request's content-type is being reset to text/plain resulting in a HTTP status of 415 from the requested content. Here is my fetch function: function doFetch(Content) { return fetch( URL, { method: 'POST', mode: 'no-cors', headers: new Headers( {'Content

CORS error, but data is fetched regardless

流过昼夜 提交于 2020-04-13 04:14:39
问题 I have a generated React site I am hosting in an S3 bucket. One of my components attempts to fetch something when loaded: require('isomorphic-fetch') ... componentDidMount() { fetch(`${url}`) .then(res => { console.log(res); this.setState({ users: res }) }) .catch(e => { // do nothing }) } The url I am fetching is an AWS API Gateway. I have enabled CORS there, via the dropdown, with no changes to the default configuration. In my console, for both the remote site and locally during development

Laravel 6 CORS policy issue with API

北慕城南 提交于 2020-04-11 22:36:05
问题 Here is what i tried Middleware return $next($request) ->header('Access-Control-Allow-Origin', '*') ->header('Access-Control-Allow-Credentials', 'true') ->header('Access-Control-Allow-Headers', 'Origin, Content-Type, Authorization, X-Requested-With, Accept, X-Token-Auth, Application') ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); API route Route::group(['middleware' => ['cors', 'auth:api']], function() { Route::options('{any}'); Route::post('user/profile',

Laravel 6 CORS policy issue with API

情到浓时终转凉″ 提交于 2020-04-11 22:35:33
问题 Here is what i tried Middleware return $next($request) ->header('Access-Control-Allow-Origin', '*') ->header('Access-Control-Allow-Credentials', 'true') ->header('Access-Control-Allow-Headers', 'Origin, Content-Type, Authorization, X-Requested-With, Accept, X-Token-Auth, Application') ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); API route Route::group(['middleware' => ['cors', 'auth:api']], function() { Route::options('{any}'); Route::post('user/profile',

Angular/Express/Passport - Authenticating with Google: No 'Access-Control-Allow-Origin

冷暖自知 提交于 2020-04-11 18:25:48
问题 Context I am building a stateless application using Angular, Express & PassportJS and want to authenticate users using their Google account. After authenticating a user, my goal is to use JWT tokens to be able to have a stateless application. Angular 2 side Upon clicking the Google sign in button, the following code gets executed in my service: login() { return this.http.get('http://localhost:3000/api/auth/google'); } Express side On express, the following gets executed: // This gets executed

Spring Security CORS filter not working

﹥>﹥吖頭↗ 提交于 2020-04-11 00:02:10
问题 I'm using spring security with OAuth2 (version: 4.0.4.RELEASE) and spring (verison: 4.3.1.RELEASE). I'm developing frontend in Angular and I'm using grunt connect:dev (http://127.0.0.1:9000). When I trying to login by localhost address everything working fine but from other I'm getting error: "XMLHttpRequest cannot load http://localhost:8084/oauth/token?client_id=MY_CLIENT_ID. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present