cors

IE 10 & 11 CORS Status 0

邮差的信 提交于 2019-12-21 17:39:02
问题 I have an IE bug I can't seem to figure out. I am supporting IE 10 and 11 only so I thought I could get away with the following code. I have an AJAX request: $.ajax({ type: {method}, url: {url}, cache: false, crossDomain: true, data: {data to send}, success: function (data, textStatus, xhr) { ///success code }, error: function (xhr, textStatus, errorThrown) { //error code } }); This code works great in Firefox and Chrome. It doesn't work in IE 10,11. I was under the impression that CORS was

CORS express not working predictably

爱⌒轻易说出口 提交于 2019-12-21 17:18:32
问题 I am trying to allow access from everywhere. I have tried using app middleware: app.use(function (req, res, next) { res.setHeader("Access-Control-Allow-Origin", "*"); res.setHeader('Access-Control-Allow-Methods', '*'); res.setHeader("Access-Control-Allow-Headers", "*"); next(); }); I have tried using it in the route: app.post('/login',function(req,res){ var login = req.body; var sess = req.session; if (!login.email && !login.pwd){ return res.status(401); } res.header("Access-Control-Allow

Is it safe to bypass CSRF protection for XHR? (Rails)

假如想象 提交于 2019-12-21 17:05:36
问题 A component of our webapp is (more-or-less) an SPA. i.e. it runs using javascript, and doesn't generate any page views or refreshes. This can cause CSRF tokens to go stale. Particularly for mobile phone users, who might switch the browser off and open it a few days/weeks later. This SPA occasionally needs to POST updates to the server. We see some javascript POST requests that generate a 422 error, with a warning about CSRF protection. I'm pretty sure that the CSRF token is present, but is

Yammer JS SDK — problems with CORS

社会主义新天地 提交于 2019-12-21 16:50:13
问题 It seems like something has changed on the Yammer side, because my app (not yet published to the Yammer Global App Directory) has stopped working, resulting in an obscure CORS error, that doesn't tell a thing about the problem. So the workflow is very simple — I'm ensuring that user is logged in by calling getLoginStatus() (which pops-up a window and immediately closes it. Irritating, but can live with that) Sending a request to messages/in_group/ID.json wrapped in a yam.platform.request , as

Getting Response in ContainerResponseFilter's (JAX-RS 2)

别等时光非礼了梦想. 提交于 2019-12-21 14:59:57
问题 I am trying to port this CORS filter to JAX-RS 2. However, I do not see how to get the Response object (as in the old code) from the ContainerResponseContext I get passed in the overridden method of ContainerResponseFilter. If there is a more elegant way to do CORS with JAX-RS 2, that would be preferrable of course. Thanks in advance. 回答1: Thre response is directly accessible as the ContainerResponseContext : @Provider public class ResponseCorsFilter implements ContainerResponseFilter{

Getting Response in ContainerResponseFilter's (JAX-RS 2)

梦想与她 提交于 2019-12-21 14:59:30
问题 I am trying to port this CORS filter to JAX-RS 2. However, I do not see how to get the Response object (as in the old code) from the ContainerResponseContext I get passed in the overridden method of ContainerResponseFilter. If there is a more elegant way to do CORS with JAX-RS 2, that would be preferrable of course. Thanks in advance. 回答1: Thre response is directly accessible as the ContainerResponseContext : @Provider public class ResponseCorsFilter implements ContainerResponseFilter{

CORS issue with Spring Boot

泪湿孤枕 提交于 2019-12-21 14:17:42
问题 I have a Spring Boot application running on port 8443, and an angular2 based front end on port 8080. I need my front end to make requests to my Spring server, but I'm getting CORS errors left and right. I have added the @CrossOrigin annotation to my RestController method, and I have added a CORSFilter to my project, and mapped it on web.xml , but on Firefox 46.0a2 I still get this error on the console: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

CORS issue with Spring Boot

六月ゝ 毕业季﹏ 提交于 2019-12-21 14:16:06
问题 I have a Spring Boot application running on port 8443, and an angular2 based front end on port 8080. I need my front end to make requests to my Spring server, but I'm getting CORS errors left and right. I have added the @CrossOrigin annotation to my RestController method, and I have added a CORSFilter to my project, and mapped it on web.xml , but on Firefox 46.0a2 I still get this error on the console: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

Auth::user() returns null with CORS requests

纵然是瞬间 提交于 2019-12-21 12:27:46
问题 I have a site with a separate REST API on a subdomain, e.g. api.mysite.com, that I send CRUD requests to. The API sub-domain has this filter adding the appropriate headers to the response: // Simple CORS handling Route::filter('cors', function($route, $request, $response) { $origin = Request::header('Origin'); $host = parse_url($origin, PHP_URL_HOST); // Don't send response for external domains. if (!in_array($host, Config::get('domains'))) { App::abort(); } $response->headers->set('Access

Server cannot set status after HTTP headers have been sent - web api CORS

↘锁芯ラ 提交于 2019-12-21 12:10:33
问题 Alright all, I've been bashing my head bloody over this one... The Set Up: I have a Web Api 2.0 Project with Basic Authentication set up. I have CORS enabled in the web.config I have ELMAH logging errors I have a DelegatingHandler handling the incoming request - (code below) I have a very specific data structure so I'm not using Membership or Identity by Microsoft. I'm flushing every request that comes in that uses the OPTIONS verb The Problem: I am getting the following error on EVERY