Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8410275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:08:04+00:00 2026-06-10T00:08:04+00:00

In my routes.rb I have a custom path defined: match foo/copy => foo#copy, :via

  • 0

In my routes.rb I have a custom path defined:

match "foo/copy" => "foo#copy", :via => [ :post ], :as => "copy_foo"

I have an initializer in my config/initializers directory named https_by_default.rb, which contains one line:

Rails.application.routes.default_url_options[:protocol] = 'https'

If I run rails console and type Rails.application.routes.default_url_options, it returns {:protocol => 'https} as expected.

But in my view where I am using the generated custom path _url helper, it doesn’t generate the URL with https. <%= copy_foo_url() %> in the ERB returns http://localhost:3000/foo/copy.

What am I missing in order to get my named routes helpers to respect default_url_options?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:08:05+00:00Added an answer on June 10, 2026 at 12:08 am

    You should use the following instead:

    <%= copy_foo_path() %>
    

    And in your application config file add.

    config.force_ssl = true
    

    This enables ssl on all your Rails environments. If you want to enable ssl on your production environment only, then just add the line to your production config file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem using my url view helper. I have defined custom routes
I have defined 2 custom routes. One for threads/:id/:name and the other for threads/tags/:tagName
I have this custom route in my routes.rb match '/businesses/:permalink', :to => 'businesses#show', :as
I made a custom handler that derives from MvcHandler. I have my routes using
In my routes I have: resources :accounts This produces: accounts GET /accounts(.:format) accounts#index POST
So, I have implemented custom routing in mysite. routes.MapRoute( WithFriendlyNameOnly, {friendlyName}, new { controller
So I have a custom route as such: routes.MapRoute( Wizard, // Route name Wizard/{page},
I have custom error handling defined for my application and it all works wonderfully
I have no custom routes in my application, only the default one. If i
I have a custom MVC PHP framework that has a router class, which calls

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.