cors

How to set CORS headers into internal server error responses?

纵然是瞬间 提交于 2019-12-23 14:41:48
问题 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",

Why Cors doesn't work after update to beta8 on ASP.NET 5?

耗尽温柔 提交于 2019-12-23 14:38:54
问题 I have updated ASP.NET 5 to beta8 and changed the dependency to "Microsoft.AspNet.Cors": "6.0.0-beta8". After that i get an error in ConfigureServices in line services.ConfigureCors(options => { options.AddPolicy("AllowAllOrigins", builder => builder.AllowAnyOrigin()); }); Error CS1929 'IServiceCollection' does not contain a definition for 'ConfigureCors' and the best extension method overload 'MvcCorsMvcCoreBuilderExtensions.ConfigureCors(IMvcCoreBuilder, Action)' requires a receiver of type

c# Web Api with CORS Enabled and the dreaded No 'Access-Control-Allow-Origin' header is present on the requested resource

烈酒焚心 提交于 2019-12-23 12:49:44
问题 I have a C# Web API project. I created a Controller using the Web API 2 standard. I am trying to enable CORS on only one action, this is what I have: namespace MyProject.Controllers { public class MyControllerController : ApiController { // POST api/mycontroller [EnableCors("http://link.myurl.com", "*", "*")] public bool Post(MyCustomObject customObject) { // Function that returns Bool return myFunction(customObject); } } } My WebApiConfig.cs looks like this: // Web API configuration and

How to discard preflight response in AngularJS

丶灬走出姿态 提交于 2019-12-23 12:42:06
问题 When sending a http.post request to my service I initially send an Option request (as required by Cors). However I've realized that my OPTIONS (pre-flight) request is returning no response.data in its response, but my POST request is. This poses a problem as I need to access the response.data from the POST response... Does Angular allow us to somehow discard the OPTIONS response in a http.post call? $http.post("http://api.worksiteclouddev.com/RestfulAPI/api/vw_PeopleListSiteAccess_Update/Get/

Why is CORS Disabled by Default?

天大地大妈咪最大 提交于 2019-12-23 12:40:54
问题 Alright, first of all, I am absolutely aware that we have a bunch of answers on this and there is a plethora of articles on the topic. I just read these answers a second before typing this: Why is CORS without credentials forbidden?. Is CORS considered bad practice? Etc. My particular situation is this - I just set up WebAPI2 for my practice project, the front end for which is running via gulp browser-sync. I have no idea how these ports get picked, but lets say the Web API is running on port

“WARNING: Can't verify CSRF token authenticity” error - CORS with Devise and :token_authenticatable

爷,独闯天下 提交于 2019-12-23 11:49:09
问题 I have a single page app that authenticates to another domain using CORS. All the requests are JSON requests. My app can authenticates OK and can make GET requests OK. Authentication is using token_authenticatable. I.e. all requests append '?auth_token=whatever' So, my actual problem is that when I try to do a PUT request I get a WARNING: Can't verify CSRF token authenticity message in the rails log as well as a CanCan::AccessDenied (You are not authorized to access this page.) exception.

Typeface and Images Cross-Origin Resource Sharing

纵然是瞬间 提交于 2019-12-23 11:45:23
问题 I noticed that typeface are always subject to Cross-Origin Resource Sharing(CORS) and the images are not. SCENARIO Website A: On this website, we have a limitation on uploading resources. We can only upload HTML file. All external files are pointing to Website B. Website B: All resources are uploaded to this website. Image are okay and working fine but the fonts are not. Below is an example of an error log. I'm curious if is it always like that? like fonts are always subject to CORS and

How to add CORS (cross origin policy) to all domains in NGINX?

眉间皱痕 提交于 2019-12-23 10:56:28
问题 I have created a folder that will be used for serving static files (CSS, images, fonts and JS etc) I will eventually CNAME the folder into a subdomain for usage on a CDN to work with my Magento 2 setup. I want to allow ALL domains ALL access via CORS - Cross Origin Policy and I want to cache the data too. This is what I have. (I am not asking for security suggestions or tips on JSONP issues - I want global access to the file directory please) location /cdn-directory/ { location ~* \.(ico|jpg

Fixing js “Script error”

元气小坏坏 提交于 2019-12-23 09:57:43
问题 I'm having difficulties implementing something simple: I have an index.html file served on http://localhost:3200 by ruby on rails, which uses a javascript file served on http://localhost:8000 by webpack-dev-server. So here's what I have: <!doctype html> <head> <script crossorigin="anonymous" src="http://localhost:8000/app.js" /> </head> <!-- ... --> </html> My app.js file is sent with, amongst others, the following header: Access-Control-Allow-Origin: * What I want is to be able to override

AJAX Request From HTTPS Page to HTTP Url

和自甴很熟 提交于 2019-12-23 09:02:14
问题 I have a case where I need to perform an AJAX request from an HTTPS page to another one (on a different domain) that is not secure. We've already implemented CORS policy and it was working fine before using HTTPS on our website. Is there any way to make this work? 回答1: According to W3, it's not possible through a COR policy due to "certificate errors" http://www.w3.org/TR/access-control/#user-agent-security 来源: https://stackoverflow.com/questions/14703549/ajax-request-from-https-page-to-http