Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS issue in Cordova app API Integration #23

Open
ravimehta5690 opened this issue Feb 23, 2019 · 1 comment
Open

CORS issue in Cordova app API Integration #23

ravimehta5690 opened this issue Feb 23, 2019 · 1 comment

Comments

@ravimehta5690
Copy link

Access to XMLHttpRequest at 'https://www.domain.com/staging/api/customer/[email protected]&password=xxx' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

@ravimehta5690
Copy link
Author

ravimehta5690 commented Feb 23, 2019

#Solved by using
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"

Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request.

RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
in
Root .htaccess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant