Hi there
I'm working on a inventory web app here and I'm trying to gather some basic
information about registered hosts to foreman using the API.
Browsers preflight ajax requests to different domains with an OPTIONS
request…
"the specification mandates that browsers "preflight" the request,
soliciting supported methods from the server with an HTTP OPTIONS request
method, and then, upon "approval" from the server, sending the actual
request with the actual HTTP request method."
This isn't working with foreman, the OPTIONS request returns a 404. Here's
the snippet from production.log
Started OPTIONS "/api/v2/hosts" for x.x.x.x at 2014-12-24 08:45:06 +0100
ActionController::RoutingError (No route matches [OPTIONS] "/api/v2/hosts"):
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in
`process_request'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:in
`accept_and_process_next_request'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in
`main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler.rb:441:in
`block (3 levels) in start_threads'
We have added these options to apache but this doesn't help.
I guess it's because everything goes to foreman / passenger anyway…
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods: "GET, POST, PUT, DELETE,
OPTIONS"
We're running foreman 1.6.2.
Any help would be appreciated.
Regards
Sandro