Questions tagged [rack-cors]

40 questions
0
votes
0 answers

Sinatra: How to position a new middleware in stack

I'm using Rack::Cors middleware for CORS permission and I want to be able to place it first in the middleware stack. I couldn't find a simple way to place it like Ruby on Rails config.middleware.insert_before(existing_middleware, new_middleware,…
Marcelo Fonseca
  • 1,173
  • 1
  • 11
  • 30
0
votes
1 answer

How do I declare Content-Range in the Access-Control-Expose-Headers header using rack-cors

In order to access my api from frontend it is asking I declare Content-Range in the Access-Control-Expose-Headers header. I can't figure out exactly how to write it. Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do …
0
votes
1 answer

Testing CORS while sending request from a local NextJS server to a local Rails api server

I have two servers both of them running on localhost. On port 3000 it's a NextJs development server and on port 4000 i am running a Rails Api only server. I have not added any extra libraries or packages. I have a api endpoint like…
sakib 1212
  • 50
  • 4
0
votes
0 answers

Prevent nginx from removing CORS headers set by rack-cors

Context I use Docker to deploy my Rails application with an nginx container as my front HTTP server. I configured rack-cors in Rails to send CORS headers for some URLs. My application is available using 2 different domains using HTTPS, configured in…
Vincent Robert
  • 33,284
  • 13
  • 77
  • 115
0
votes
1 answer

Rails 5.1 API CORS problems

I have a rails 5.1.6 api that generates json. I have a separate Vue.js client that aims to consume it. The model is entities. The GET request works fine to view the index of all entities in the db. However, when I attempt to POST a new entity, I get…
user2799827
  • 655
  • 1
  • 10
  • 30
0
votes
1 answer

Check if request comes from server or browser

Using Rails in API mode. Also have the rack-cors gem installed with my own domains whitelisted. I'd also like to minimally secure my API with an API key added to requests made from a server . I suspect this might be a stupid question, but is there a…
user3325749
  • 161
  • 1
  • 11
0
votes
1 answer

How to get rid of Cross-Origin Request Blocked: in rails 4

Can you please tell me where I have gone wrong and is there anything left out that I has to add to fetch the json from heroku site config.ru require ::File.expand_path('../config/environment', __FILE__) run Rails.application use Rack::Cors do allow…
0
votes
1 answer

Rails cross domain ajax get request (CORS)

I'm trying to implement google places api in my rails app. This is the error I'm getting when trying to use the function that is fetching the data from the ajax request: XMLHttpRequest cannot load . Response to preflight request doesn't pass access…
Max Dubinin
  • 164
  • 18
0
votes
1 answer

Add custom response header with Rack-cors and Grape

I'm developing a Ionic(Cordova) app with a Ruby on Rails API. I want to use response headers to return a token after login. I'm using rack-cors gem to make Cross Origin Request work: application.rb config.middleware.insert_after Rails::Rack::Logger,…
Shrolox
  • 613
  • 5
  • 21
0
votes
1 answer

rails, rack-cors, nginx, angualrjs and cors

Still getting "Origin MYSITE.com is not allowed by Access-Control-Allow-Origin." errors. in my controller i have def subscribe gibbon = Gibbon::Request.new @list_id = 'some_id' begin resp = gibbon.lists(@list_id).members.create({body:…
pcasa
  • 3,640
  • 7
  • 37
  • 66
1 2
3