cors

Get request origin in C# api controller

為{幸葍}努か 提交于 2020-05-10 07:31:07
问题 Is there a way how can I can get request origin value in the api controller when I'm calling some api endpoint with ajax call? For example I'm making this call from www.xyz.com: $http({ url: 'http://myazurewebsite.azurewebsites.net/api/ValueCall/CheckForExistingValuers', method: "GET", params: { loanID: $scope.loanIdPopup } }).success(function (data) { }).error(function (data) { }); Once on the api side, how can I get the www.xyz.com value? CORS is working properly. 回答1: What you're looking

Safari 10.1: XMLHttpRequest with query parameters cannot load due to access control checks

不羁岁月 提交于 2020-05-10 03:49:27
问题 When trying a CORS request on Safari 10.1 , on an URL which includes query parameters (e.g. https://example.com/api?v=1), Safari says XMLHttpRequest cannot load due to access control checks Chrome/Firefox works fine. On requests from the page without the ?v=1 , Safari works fine too. I tried changing the server response header from Access-Control-Allow-Origin: https://example.com to Access-Control-Allow-Origin: https://example.com/api?v=1 but that breaks Chrome. Any suggestions? 回答1: Trying

How to enable CORS in Laravel?

故事扮演 提交于 2020-05-09 02:21:13
问题 I am in Laravel 5.8 - I kept getting this CORS issue I've tried php artisan make:middleware Cors Add these code <?php namespace App\Http\Middleware; use Closure; class Cors { public function handle($request, Closure $next) { return $next($request) ->header(‘Access-Control-Allow-Origin’, ‘*’) ->header(‘Access-Control-Allow-Methods’, ‘GET, POST, PUT, DELETE, OPTIONS’) ->header(‘Access-Control-Allow-Headers’, ‘X-Requested-With, Content-Type, X-Token-Auth, Authorization’); } } restart my local

Enable CORS in lumen

笑着哭i 提交于 2020-05-08 08:22:01
问题 I have API developed using lumen. I can get request using postman. But when request using Jquery.ajax it is not working. So I need to know how to enable CORS in lumen API. 回答1: Consider creating a CorsMiddleware.php file with the following code. Find detail here. <?php namespace App\Http\Middleware; use Closure; class CorsMiddleware { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request,

Enable CORS in lumen

℡╲_俬逩灬. 提交于 2020-05-08 08:21:10
问题 I have API developed using lumen. I can get request using postman. But when request using Jquery.ajax it is not working. So I need to know how to enable CORS in lumen API. 回答1: Consider creating a CorsMiddleware.php file with the following code. Find detail here. <?php namespace App\Http\Middleware; use Closure; class CorsMiddleware { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request,

We are getting CORS issue in Azure WebAPP still i have allowed all origin as “*”

ε祈祈猫儿з 提交于 2020-04-30 11:04:33
问题 I am getting CORS issue in PROD environment when i am try to login into the site.when i set origin policy as "*" . still it is giving the same CORS issue. Access to XMLHttpRequest at 'https://XYZ.azurewebsites.net/api/users/userlogin' from origin 'https://XYZ.azurewebsites.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. I also have specified the CORS policy in

Preflight response 403 forbidden. How can I allow options method without x-api-key?

偶尔善良 提交于 2020-04-30 08:47:22
问题 I'm using SAM to create my API in cloudformation. I'm getting a 403 FORBIDDEN on my options method (thus also my preflight for my get method). How can I allow my options method to reply with 200 OK without my x-api-key? I've tried so many stackoverflow answers but none fit my SAM template format. I've tried all the different combinations of my AllowHeaders. I've ommited the x-api-key - still the same 403 FORBIDDEN. If I send my x-api-key in postman with my request I get a 200 OK, but in my

cross origin problems with extjs 6.01

萝らか妹 提交于 2020-04-29 03:23:12
问题 I'm using a POST form to login on my backend which works without any problem. The backend accepts all locations (*) After I login, I'm ready to get some data and then I get Cross-Origin-request blocked: the Same Origin Policy doesn't allow thebackend.test/Statistics/.stat (Reason: CORS-header ‘Access-Control-Allow-Origin’ doens't corrspond with ‘*’). onLoginClick: function(buttons){ // this.onLoginSuccess(null,null); // return; var me = this; var loginForm = this.lookupReference('loginForm');

cross origin problems with extjs 6.01

為{幸葍}努か 提交于 2020-04-29 03:22:52
问题 I'm using a POST form to login on my backend which works without any problem. The backend accepts all locations (*) After I login, I'm ready to get some data and then I get Cross-Origin-request blocked: the Same Origin Policy doesn't allow thebackend.test/Statistics/.stat (Reason: CORS-header ‘Access-Control-Allow-Origin’ doens't corrspond with ‘*’). onLoginClick: function(buttons){ // this.onLoginSuccess(null,null); // return; var me = this; var loginForm = this.lookupReference('loginForm');

CORS impossible on AWS Lambda HTTP API Gateway Integration

别等时光非礼了梦想. 提交于 2020-04-28 19:04:31
问题 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"