D
D
Danil2014-02-24 16:08:05
JavaScript
Danil, 2014-02-24 16:08:05

What is the method to bypass the same origin policy?

There is a folder. In the folder there is a simple node.js server running on port 8888 and a client.js file from which I want to make an ajax request to the server. Seim Orizhn policy does not let me through. I read about JsonP, manifest.json, about headers, but it was not possible to apply Google. I would be happy for a ready-made example using any method to bypass the seim origin policy or for an sensible article / book / blog that describes how to do it

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
snackovich, 2014-02-24
@Veneomin

You only need to add settings in the headers of the response (valid for express) that
allow access

app.use(function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "X-Requested-With");
    next();
});

or you can include the library for express
https://www.npmjs.org/package/cors

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question