This project is archived and is in readonly mode.

#4461 ✓stale
rabbitt

Site-wide HTTPS difficult to enforce programatically

Reported by rabbitt | April 23rd, 2010 @ 06:40 AM

It would be nice if there was a simple way to flip a setting and have all generated urls use HTTPS proto instead of HTTP. So, I threw together a quick patch (attached) to do just that (granted against an older version of actionpack - so your mileage may vary).

To force all routes to use 'https' you would simply do the following in your routes.rb (or environment.rb, or wherever...):

ActionController.UrlWriter.default_proto = 'https'

Comments and changes to this ticket

  • Ryan Bigg

    Ryan Bigg April 24th, 2010 @ 10:58 AM

    It would be better if this option was called default_protocol rather than default_proto. Could you also try applying this patch to master and writing some tests for it?

  • rabbitt

    rabbitt April 24th, 2010 @ 08:05 PM

    Sure thing - I'll put something together by Monday or Tuesday.

    Cheers!,

    -- Carl

  • Neeraj Singh

    Neeraj Singh April 25th, 2010 @ 12:15 PM

    Attached is code patch against rails3 edge.

    Could not add any test because introduction of app.config is causing problem and I don't really know how to inject app in the concerned class/module in test environment. If anyone has any tips on how to write test then let me know.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:43 PM

    • State changed from “new” to “open”
    • Importance changed from “” to “Low”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:43 PM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages