Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect not working #34

Closed
hallmatt opened this issue Mar 7, 2012 · 4 comments
Closed

Redirect not working #34

hallmatt opened this issue Mar 7, 2012 · 4 comments

Comments

@hallmatt
Copy link

hallmatt commented Mar 7, 2012

I'm trying to use this gem to enforce the SSL on the site. If I got to mydomain.com, it correctly redirects me to https://www.mydomain.com. Once I'm there, if I take off the www. and just go to http://mydomain.com, it renders the site at http://mydomain.com, which breaks the SSL since the SSL only works with the WWW subdomain.

Here's what I have in my production.rb file:

config.middleware.use Rack::SslEnforcer, :redirect_to => 'https://www.mydomain.com', :strict => true

Any thoughts on how I can force the site to always render https://www.mydomain.com?

Thanks!

@tobmatth
Copy link
Owner

tobmatth commented Mar 7, 2012

If you don't want to force http for any paths / subdomains / whatever,
just remove the strict option.

Best,
Tobi

@hallmatt
Copy link
Author

hallmatt commented Mar 8, 2012

Tobi-

Thanks for your reply.

I do want to enforce SSL at all times. Only the "www." sub-domain is setup to work SSL'd. Initially going to the domain, the gem redirects to https://www.mydomain.com, but once I'm there, if someone takes off the "www." and just goes to https://mydomain.com, it doesn't redirect you back to https://www.mydomain.com, as it should.

Matt

On Mar 7, 2012, at 12:27 PM, Tobias Matthies wrote:

If you don't want to force http for any paths / subdomains / whatever,
just remove the strict option.

Best,
Tobi


Reply to this email directly or view it on GitHub:
#34 (comment)

@tobmatth
Copy link
Owner

Hey Matt,

should be fixed with commit c5542b6, please use the git version in your Gemfile until a new Gem is released.

@hallmatt
Copy link
Author

Tobi-

Thanks for your help on this issue. That commit didn't help, so I tried d0b882a, and that didn't seem to fix the issue.

Here's what I'm using in my

gemfile: gem 'rack-ssl-enforcer', :git => 'https://github.com/tobmatth/rack-ssl-enforcer.git', :ref => "d0b882a4f9bb9048ab4fedb82816ea4dfe93019a"

I'll email you the URL I'm referring to.

Matt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants