Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

No 'Access-Control-Allow-Origin' header on preflight

ANSWERED

Hi. I'm making calls to Fitbit and have only tested in Chrome this far. I recieve:

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource...

 

 

I was reading in this post that Fitbit is supporting CORS but it doesn't seem like it, am I wrong?

 

Thanks

Daniel

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

The Fitbit Web API supports CORS. Here's it working in a quick test I just did.

 

Screen Shot 2016-03-30 at 2.51.38 PM.png

View best answer in original post

Best Answer
0 Votes
6 REPLIES 6

The Fitbit Web API supports CORS. Here's it working in a quick test I just did.

 

Screen Shot 2016-03-30 at 2.51.38 PM.png

Best Answer
0 Votes

Did your preflight request properly set a `referer` header?

Best Answer
0 Votes

Yes, it had the correct referrer. I managed to solve by adding some headers to my .htaccess! Thanks for your time though 🙂

Best Answer
0 Votes

Could you post what headers you added to .htaccess? Thanks!

Best Answer
0 Votes

Sure, what worked for me was adding this:

<IfModule mod_headers.c>
#Header add Access-Control-Allow-Origin "http://mydomain.com"
#Header set Access-Control-Allow-Origin "*"
#Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE"
#Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"
</IfModule>

Best Answer
0 Votes

Just this work for me

 

<IfModule mod_headers.c>
Header add Access-Control-Allow-Origin "*"
</IfModule>

 

And checkout this guide for Cross Origin Access Header, very good explaination on how it works

Best Answer
0 Votes