title: Setting-up CORS - 'Access-Control-Allow-Origin' with ruby
body: <p>I'm fairly new to coding and am learning about Devise/Omniauth at the moment. I'm working on a tutorial to get a user to connect with Facebook through Omniauth as an example but get the following error in the console:</p>
  
  <pre><code>XMLHttpRequest cannot load https://www.facebook.com/dialog/oauth?client_id=... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
  </code></pre>
  
  <p>I understand that for security reasons, some browsers are not allowing CORS request. I did find many related topics on StackOverflow (<a href="https://stackoverflow.com/questions/9613210/cors-access-control-allow-origin-despite-correct-headers">link1</a>, <a href="https://stackoverflow.com/questions/21709790/no-access-control-allow-origin-header-is-present-on-the-requested-resource">link2</a>, <a href="https://stackoverflow.com/questions/24134117/no-access-control-allow-origin-header-is-present-on-the-requested-resource-an?rq=1">link3</a>,<a href="https://stackoverflow.com/questions/3102819/disable-same-origin-policy-in-chrome?lq=1">link4</a>,<a href="https://stackoverflow.com/questions/9310112/why-am-i-seeing-an-origin-is-not-allowed-by-access-control-allow-origin-error?lq=1">link5</a>) and that the main thing is to allow </p>
  
  <pre><code>Access-Control-Allow-Origin: *
  </code></pre>
  
  <p>I tried it and couldn't get it to work. Because I'm using ruby, I also found out that there is a gem called (<a href="https://github.com/cyu/rack-cors" rel="nofollow noreferrer">Rack-Cors</a>) to allow CORS requests with ruby and thought to myself "Cool, I'm saved" but I couldn't get it to work either.</p>
  
  <p>Running out of option and because I'm running Chrome, I also tried to open chrome that way</p>
  
  <pre><code>open /Applications/Google\ Chrome.app --args --disable-web-security
  </code></pre>
  
  <p>It didn't work either. I tried different things for the past days and cannot get the Omniauth Facebook login to work (PS: I have allowed access to <a href="http://localhost:3000/" rel="nofollow noreferrer">http://localhost:3000/</a> in the Facebook developers settings page of my app)</p>
  
  <p>Please find enclosed the link to my repository on Github:
  <a href="https://github.com/GBouffard/yelp_clone" rel="nofollow noreferrer">repository</a></p>
  
  <p>What a I doing wrong? Are there some specific way to set-up CORS that I'm missing? If anyone could help or know how to make it work with ruby/chrome, it would be greatly appreciated. Thanks.</p>