Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7020 (new enhancement)

Opened 2 years ago

Last modified 2 years ago

[PATCH] tiny ssl_requirement plugin: disable ssl_forwarding in development + Apache 2.0 fix

Reported by: ideawire_bb Assigned to: core
Priority: low Milestone: 2.x
Component: Plugins Version: edge
Severity: trivial Keywords: ssl_requirement, localhost development tiny
Cc: bitsweat, DerGuteMoritz

Description

I apologize for not attaching the patch diff - this is my first time and I've not been able to figure out how to attach it. Please consider including a sentence on the Contribute page for new contributors.

This change addresses two issues. First, Nate Jones of Media Temple openly contributed the port check, which enables the plugin to work on Apache 2.0 and above versus just Apache 2.2+. My contribution allows developers using the WEBrick server to use this plugin and be able to continue to see their work locally.

Without my code, actions associated with the plugin will fail since the request will forward to https:// on localhost. Most developers won't have installed an ssl cert to remedy this issue. Given the endorsement of the plugin in the second edition book, it's highly likely that other developers (especially newbies such as myself) will utilize this resource and potentially be frustrated when they can't see their work locally - this resolves that issue with the only assumption that they haven't modified the default port number.

The change is a single line, so I'm going to copy and paste it below.

File: vendor/plugins/ssl_requirement/lib/ssl_requirement.rb

17 - if ssl_required? && !request.ssl?

18 + if ssl_required? && !(request.ssl? request.port == 443) && request.port_string != ":3000"

Thanks for your consideration.

Attachments

disable_ssl_forwarding_in_development.diff (1.5 kB) - added by ideawire_bb on 01/13/07 04:44:37.
ignore_ssl_requirement_in_development_mode.patch (1.0 kB) - added by DerGuteMoritz on 10/24/07 19:16:41.
checks the Rails environment rather than the server port

Change History

01/13/07 04:44:37 changed by ideawire_bb

  • attachment disable_ssl_forwarding_in_development.diff added.

01/13/07 05:32:10 changed by bitsweat

  • cc set to bitsweat.
  • keywords changed from ssl_requirement, localhost development to ssl_requirement, localhost development tiny.

10/24/07 19:15:39 changed by DerGuteMoritz

+1 for a change like this. I've attached a patch which in my opinion is more reasonable since it checks the Rails environment rather than the server port. I don't know how to test this though!

10/24/07 19:16:41 changed by DerGuteMoritz

  • attachment ignore_ssl_requirement_in_development_mode.patch added.

checks the Rails environment rather than the server port

10/24/07 19:20:32 changed by DerGuteMoritz

  • cc changed from bitsweat to bitsweat, DerGuteMoritz.