Search code examples
ruby-on-railsapacheroutespassenger

No route matches only in production


I'm stuck with a real strange problem.

I'm deploying my app through Passenger (with Apache). When I try my app on my computer everything is fine but when I deploy it, I have some troubles with routes... Found routes in local are not found in production.

I've seen and tried this post but it's not working.

I had some troubles with assets and precompilation. I thought it was done but finally not.

If I try:

localhost:3000/api/my_key

myurl/api/my_key

I have this error on my server:

ActionController::RoutingError (No route matches api/8dd8ec0f20a25777775d02655f7af8ec1918b)
  app/controllers/application_controller.rb:39:in `unmatched_route'

routes.rb:

[...]
scope constraints:  Rails.configuration.api_routing,
  defaults:     Rails.configuration.api_routing do
    namespace :api do
      ..
    end
  end
end

Application.rb:

config.api_routing = {host: "myurl"}

ApplicationController.rb

def unmatched_route
  raise ActionController::RoutingError.new("No route matches #{params[:unmatched_route]}")
end

What can I try next?


Solution

  • Problem solved, it came from my DNS redirection and not from my app. This issue was linked to this one.