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

Added secure flag by default if rack env shows protocol/scheme is https #193

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

amasses
Copy link

@amasses amasses commented Feb 12, 2018

While it is possible to specify secure: true when using the middleware, its pretty difficult to set this, and I think that this should be a default, rather then a difficult opt-in.

@bleonard
Copy link
Contributor

Looks good to me. Is there a use case where someone wouldn't want us to mess with this?

@amasses
Copy link
Author

amasses commented Feb 19, 2018

Could be where someone is running across both HTTPS and HTTP, however I think this use case is getting much smaller.

I suspect if this is the case they should be able to load the middleware themselves and specify secure: false (though the reason for this PR was because doing that was overly complicated...

@eugeneius
Copy link

eugeneius commented Mar 11, 2018

While mixing HTTP and HTTPS is less common than it used to be, it seems like overreach for us to set a secure cookie whenever the current request is over HTTPS.

For Rails apps, we could default to secure cookies if config.force_ssl is true, i.e. change:
https://github.com/taskrabbit/makara/blob/560dc333f76138c09f25f1fd3afa2d3da473f6a2/lib/makara/railtie.rb#L5

To:

  app.middleware.use Makara::Middleware, secure: app.config.force_ssl

Non-Rails apps would still have to manually pass the secure option - but they already have to add the middleware manually, so it's relatively easy to configure.

@ankane
Copy link
Contributor

ankane commented May 16, 2019

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

Successfully merging this pull request may close these issues.

4 participants