Rails4 fix force ssl redirect

Hopefully a fix for #3283

Late night here on Sunday after long day so I'm sorry if it doesn't make sense. Seems to fix that issue for me. I'll double check it in the morning to confirm it doesn't introduce any other issues.

@jdutil you might be interested in this one

please read the commit message for details (@github decided not to copy it here automatically as it usually does)