title: Rails Routes Different In Development and Production
body: <p>I have a route working just fine in my development environment, but for some reason it's not working in production and I can't figure out why.</p>
  
  <p>When I go to <code>http://localhost:3000/api/v1/register_panelist?api_key=ff4a6fa1c975693bedc2122e6943946b</code> in my development environment, it works great.</p>
  
  <p>However, when I go to <code>http://example.com/api/v1/register_panelist?api_key=ff4a6fa1c975693bedc2122e6943946b</code> it does not resolve, and ends up falling to a "page not found" which is the catch all route at the bottom of my routes file.</p>
  
  <p>In my <code>routes.rb</code> file I have this:</p>
  
  <pre><code>constraints(ApiConstraint) do
  
    namespace :api, defaults: {format: 'json'} do
      namespace :v1, defaults: {format: 'json'} do   
  
        match "register_panelist", to: "appusers#register_panelist", via: 'get'   
        match "get_surveys", to: "appusers#get_surveys", via: 'get'     
  
      end
    end
  
    match "api/v1/*path", to: "api/v1/misc#api_not_found_404", via: :all, format: 'json'
  end
  
  ...
  #at the very bottom
  match "*path", to: "static_pages#not_found_404", via: :all, format: false #, :constraints =&gt; {:format =&gt; [:html, :png]}
  </code></pre>
  
  <p>In my development environment it seems to resolve correctly. But in production it seems to be falling through to the bottom of the <code>routes.rb</code> file.</p>
  
  <p>Any ideas why?</p>
  
  <p><strong>EDIT:</strong> Adding Logs:</p>
  
  <p>Production:</p>
  
  <pre><code>    production.log — I, [2017-02-12T11:55:31.455331 #27545] INFO -- : Started GET "/api/v1/register_panelist.json?api_key=ff4a6fa1c975693bedc2122e6943946b&amp;country_id=9&amp;birthday_year=1989&amp;birthday_month=2&amp;birthday_day=16&amp;gender=42198&amp;hispanic=42200&amp;zip=10022&amp;state=45700&amp;ethnicity=42215&amp;standard_relationship=42232&amp;standard_education=42243&amp;standard_hhi_us=43511" for 75.100.38.224 at 2017-02-12 11:55:31 +0000
  production.log — I, [2017-02-12T11:55:31.606946 #27545] INFO -- : Prod? true
  production.log — I, [2017-02-12T11:55:31.607886 #27545] INFO -- : subdomain:
  production.log — I, [2017-02-12T11:55:31.607948 #27545] INFO -- : protocol: https://
  production.log — I, [2017-02-12T11:55:31.608020 #27545] INFO -- : Prod? true
  production.log — I, [2017-02-12T11:55:31.608052 #27545] INFO -- : subdomain:
  production.log — I, [2017-02-12T11:55:31.608086 #27545] INFO -- : protocol: https://
  production.log — I, [2017-02-12T11:55:31.617812 #27545] INFO -- : Processing by StaticPagesController#not_found_404 as HTML
  production.log — I, [2017-02-12T11:55:31.617925 #27545] INFO -- : Parameters: {"api_key"=&gt;"ff4a6fa1c975693bedc2122e6943946b", "country_id"=&gt;"9", "birthday_year"=&gt;"1989", "birthday_month"=&gt;"2", "birthday_day"=&gt;"16", "gender"=&gt;"42198", "hispanic"=&gt;"42200", "zip"=&gt;"10022", "state"=&gt;"45700", "ethnicity"=&gt;"42215", "standard_relationship"=&gt;"42232", "standard_education"=&gt;"42243", "standard_hhi_us"=&gt;"43511", "path"=&gt;"api/v1/register_panelist.json"}
  production.log — I, [2017-02-12T11:55:31.636463 #27545] INFO -- : Rendered text template (0.2ms)
  production.log — I, [2017-02-12T11:55:31.636883 #27545] INFO -- : Completed 404 Not Found in 19ms (Views: 11.4ms | ActiveRecord: 0.0ms)
  </code></pre>
  
  <p>Development:</p>
  
  <pre><code>Started GET "/api/v1/register_panelist?api_key=ff4a6fa1c975693bedc2122e6943946b&amp;country_id=9&amp;birthday_year=1989&amp;birthday_month=2&amp;birthday_day=16&amp;gender=42198&amp;hispanic=42200&amp;zip=53593&amp;state=45700&amp;ethnicity=42215&amp;standard_relationship=42232&amp;standard_education=42243&amp;standard_hhi_us=43511" for ::1 at 2017-02-12 05:56:46 -0600
  Prod? false
  subdomain: 
  protocol: http://
  Processing by Api::V1::AppusersController#register_panelist as JSON
    Parameters: {"api_key"=&gt;"ff4a6fa1c975693bedc2122e6943946b", "country_id"=&gt;"9", "birthday_year"=&gt;"1989", "birthday_month"=&gt;"2", "birthday_day"=&gt;"16", "gender"=&gt;"42198", "hispanic"=&gt;"42200", "zip"=&gt;"53593", "state"=&gt;"45700", "ethnicity"=&gt;"42215", "standard_relationship"=&gt;"42232", "standard_education"=&gt;"42243", "standard_hhi_us"=&gt;"43511"}
    User Load (18.7ms)  SELECT  "users".* FROM "users" WHERE "users"."api_key" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["api_key", "ff4a6fa1c975693bedc2122e6943946b"]]
  </code></pre>
  
  <p><code>rake routes</code> output from development:</p>
  
  <pre><code>api_v1_register_panelist GET    /api/v1/register_panelist(.:format)                                                           api/v1/appusers#register_panelist {:format=&gt;"json"}
                                       api_v1_get_surveys GET    /api/v1/get_surveys(.:format)                                                                 api/v1/appusers#get_surveys {:format=&gt;"json"}
  </code></pre>
  
  <p>and production server:</p>
  
  <pre><code>api_v1_register_panelist GET    /api/v1/register_panelist(.:format)                                                           api/v1/appusers#register_panelist {:format=&gt;"json"}
                                       api_v1_get_surveys GET    /api/v1/get_surveys(.:format)                                                                 api/v1/appusers#get_surveys {:format=&gt;"json"}
  </code></pre>