Set cookies for cross origin requests

How to share cookies cross origin? More specifically, how to use the Set-Cookie header in combination with the header Access-Control-Allow-Origin? Here’s an explanation of my situation: I am attempting to set a cookie for an API that is running on localhost:4000 in a web app that is hosted on localhost:3000. It seems I’m receiving the … Read more

What’s to stop malicious code from spoofing the “Origin” header to exploit CORS?

The way I understand it, if a client-side script running on a page from foo.com wants to request data from bar.com, in the request it must specify the header Origin: http://foo.com, and bar must respond with Access-Control-Allow-Origin: http://foo.com. What is there to stop malicious code from the site roh.com from simply spoofing the header Origin: … Read more

Origin null is not allowed by Access-Control-Allow-Origin

I have made a small xslt file to create an html output called weather.xsl with code as follows: <!– DWXMLSource=”http://weather.yahooapis.com/forecastrss?w=38325&u=c” –> <xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” exclude-result-prefixes=”yweather” xmlns:yweather=”http://xml.weather.yahoo.com/ns/rss/1.0″ xmlns:geo=”http://www.w3.org/2003/01/geo/wgs84_pos#”> <xsl:output omit-xml-declaration=”yes” indent=”yes”/> <xsl:strip-space elements=”*”/> <xsl:template match=”https://stackoverflow.com/”> <img src=”https://stackoverflow.com/questions/8456538/{/*/*/item/yweather:condition/@text}.jpg”/> </xsl:template> </xsl:stylesheet> I want to load in the html output into a div in an html file which I’m … Read more

XMLHttpRequest Origin null is not allowed Access-Control-Allow-Origin for file:/// to file:/// (Serverless)

I’m trying to create a website that can be downloaded and run locally by launching its index file. All the files are local, no resources are used online. When I try to use the AJAXSLT plugin for jQuery to process an XML file with an XSL template (in sub directories), I receive the following errors: … Read more

What is an opaque response, and what purpose does it serve?

I tried to fetch the URL of an old website, and an error happened: Fetch API cannot load http://xyz. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://abc’ is therefore not allowed access. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled. … Read more

Setting Access-Control-Allow-Origin in ASP.Net MVC – simplest possible method

I have a simple actionmethod, that returns some json. It runs on ajax.example.com. I need to access this from another site someothersite.com. If I try to call it, I get the expected…: Origin http://someothersite.com is not allowed by Access-Control-Allow-Origin. I know of two ways to get around this: JSONP and creating a custom HttpHandler to … Read more

What exactly does the Access-Control-Allow-Credentials header do?

I’m trying to understand how to use CORS and am confused about what the Access-Control-Allow-Credentials header does. The documentation says Indicates whether or not the response to the request can be exposed when the credentials flag is true. But I don’t understand what the response being “exposed” means. Can anyone explain what this header being … Read more

Enabling CORS in Cloud Functions for Firebase

I’m currently learning how to use new Cloud Functions for Firebase and the problem I’m having is that I can’t access the function I wrote through an AJAX request. I get the “No ‘Access-Control-Allow-Origin’” error. Here’s an example of the function I wrote: exports.test = functions.https.onRequest((request, response) => { response.status(500).send({test: ‘Testing functions’}); }) The function … Read more

Origin is not allowed by Access-Control-Allow-Origin

XMLHttpRequest cannot load http://localhost:8080/api/test. Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin. I read about cross domain ajax requests, and understand the underlying security issue. In my case, 2 servers are running locally, and like to enable cross domain requests during testing. localhost:8080 – Google Appengine dev server localhost:3000 – Node.js server I am issuing an … Read more