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.

2
  • stackoverflow.com/a/23826620/4759033 Commented Feb 22, 2016 at 4:28
  • Stop making cross-origin requests and error will disappear... Please make sure to provide minimal reproducible example 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). Commented Feb 22, 2016 at 4:28

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

Comments

0

Try this :

header("Access-Control-Allow-Origin", "*");
header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");

1 Comment

put in inside .htaccess file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.