256MbTeam / Redmine-Scrumbler

Easy to use plugin for Redmine. It allows users to use the Scrum/Agile process in projects. Scrumbler have interactive dashboard with the ability to configure for each sprint. Plugin adds Scrum Points field in every issue in project. Scrumbler as possible using the standard redmine structure of projects.
GNU General Public License v2.0
112 stars 41 forks source link

Scrumbler Javascripts not working with SSL #60

Closed letic closed 12 years ago

letic commented 12 years ago

Hi there,

I was testing redmine_backlogs against scumbler and I like your approach better even if there are still some functionality missing. After some extensive testing I found scrumbler to be very stable, but while moving it to a pre-prod server with SSL enabled all Ajax functionalities stopped working.

I traced the issue and found out that it is coming from the Scrumbler.root_url used in all javascripts.

On line 42 of app/helpers/scrumbler_helper.rb you are using root_url to put in Scrumbler.root_url but unfortunately it seems that it always return an http URL even when running with SSL.

Investigating a bit further it seems that root_url is a Rails variable so to me it sounds like a Rails bug ? Or is it the expected behaviour ?

I implemented a workaround in the meantime as I cannot find a clean way to do this in Rails documentation. Any thoughts ?

Let me know Thanks for this great plugin LeTic

paveltsytovich commented 12 years ago

We are faced with exactly the same problem. In Firebug, we found that instead of the POST request for some reason send OPTION request, with no parameters are passed

letic commented 12 years ago

The same problem is present in the dashboard where the drag and drop of issue from one status to another doesn't work.

This is a patch that solves the issue but won't work if people are using redmine in a subfolder (I don't know if scrumbler actually works in this kind of configuration). I am amazed how scarce documentation about getting redmine URL actually is.

diff --git a/app/helpers/scrumbler_helper.rb b/app/helpers/scrumbler_helper.rb
index 6d3da52..093d5d3 100644
--- a/app/helpers/scrumbler_helper.rb
+++ b/app/helpers/scrumbler_helper.rb
@@ -39,7 +39,7 @@ module ScrumblerHelper
         :weekdays => prepare_stupid_hash.call("date.day_names").compact
       }
     }
-    javascript_tag "var Scrumbler = {}; Scrumbler.Translations = #{translations.to_json}; Scrumbler.root_url = #{root_url.to_json}; Scrumbler.possible_points = #{ScrumblerIssueCustomFi
+    javascript_tag "var Scrumbler = {}; Scrumbler.Translations = #{translations.to_json}; Scrumbler.root_url = '#{Setting['protocol']}://#{Setting['host_name']}/'; Scrumbler.possible_p
   end

   def prepare_issue_subject(issue)
@@ -109,7 +109,7 @@ module ScrumblerHelper
       :statuses => prepare_issue_statuses(sprint.issue_statuses, IssueStatus.all),
       :trackers => prepare_trackers(sprint.trackers, sprint.project.trackers),
       :issues => prepared_issues,
-      :url => project_url(sprint.project),
+      :url => "#{Setting['protocol']}//#{Setting['host_name']}/projects/#{sprint.project.identifier}",
       :current_user_id => User.current.id
     }.to_json
     out = "<div id='#{div_id}' style='width:100%;height:100%;'>&nbsp;</div>"
xeta commented 12 years ago

You run Redmine under Apache with SSL module? Have you following configuration?

RequestHeader set X_FORWARDED_PROTO 'https'

Did you change protocol from "http" to "https" in redmine settings?

letic commented 12 years ago

Hey Ivan,

Thanks for answering.

You run Redmine under Apache with SSL module? Have you following configuration?

RequestHeader set X_FORWARDED_PROTO 'https'

Nope I am using nginx with phusion passenger and SSL. Here is the configuration :

server {
  listen 443 default ssl;
  server_name ...
  proxy_ignore_headers Set-Cookie;

  ssl_certificate ...
  ssl_certificate_key ...

  ssl_session_timeout 5m;
  ssl_protocols SSLv3 TLSv1;
  ssl_ciphers RC4:HIGH:!aNULL:!MD5;
  ssl_prefer_server_ciphers on;

  root /usr/local/share/redmine/public;

  location / {
    passenger_enabled on;
  }

Don't know if this header would still be needed. I only used it for proxies usually.

Did you change protocol from "http" to "https" in redmine settings?

Yep or ruby Setting['protocol'] wouldn't return the correct value :)

zloydadka commented 12 years ago

if you use nginx just add to your location: proxy_set_header X-Forwarded-Proto https;