Closed xiaopow closed 3 years ago
@xiaopow Using the :if
option on a resource declaration should work
@cyu , so this solution?
# application.rb
allow do
origins '*'
resource '/*',
:headers => :any,
:methods => [:get, :post, :patch, :options],
:if => proc { |env| env['HTTP_HOST'] == 'api.foo.com' }
end
My server serves both the api.foo.com and app.foo.com domains.
@xiaopow yes
I've got a subdomain constraint in routes.rb for my API endpoints, I want to expose this subdomain route for CORS. How can I do this?
Will the following work for this case?
Or I can do something like this?