1

Hi i have deployed my application in filezilla and now i am getting Cross-Origin Request Blocked error

In my browser if i disable web security it is working, without this what is the solution for this error.

Sudhir
  • 1
  • 1
  • 9
  • 24
  • http://stackoverflow.com/a/23826620/4759033 – Satej S Feb 22 '16 at 04:28
  • Stop making cross-origin requests and error will disappear... Please make sure to provide [MCVE] inline in the question so it will be up to SO standards and can be answered insted of potentially being donwvoted/closed (unless you simply trying to promote your site as hidden spam). – Alexei Levenkov Feb 22 '16 at 04:28

2 Answers2

1

you can try this on server side in response object. and at the client side use mozilla firefox browser if your are not pushing pages through server.

function(req, res, next) {
            res.header('Access-Control-Allow-Origin', '*');
            res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
            res.header('Access-Control-Allow-Headers', 'Content-Type, Accept');

            if ('OPTIONS' == req.method) {
                res.send(200);
            }
            else {
                next();
            }
        };

Thanks

Komal Singh
  • 451
  • 5
  • 19
0

Try this :

header("Access-Control-Allow-Origin", "*");
header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
Arief Grando
  • 209
  • 2
  • 12