-
Notifications
You must be signed in to change notification settings - Fork 417
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
add LIVEBOOK_FORCE_SSL env #1064
Changes from 4 commits
cdea591
065a5c1
5f1d3ec
f1f2534
d01aeb1
e05a6cc
57e6def
24cab67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -83,6 +83,20 @@ defmodule LivebookWeb.Endpoint do | |||||||||||||||||||
|
||||||||||||||||||||
plug LivebookWeb.Router | ||||||||||||||||||||
|
||||||||||||||||||||
plug :force_ssl | ||||||||||||||||||||
|
||||||||||||||||||||
def force_ssl(conn, _opts) do | ||||||||||||||||||||
force_ssl = Application.get_env(:livebook, :force_ssl, false) | ||||||||||||||||||||
force_ssl_host = Application.get_env(:livebook, :force_ssl_host, nil) | ||||||||||||||||||||
|
||||||||||||||||||||
if force_ssl || force_ssl_host do | ||||||||||||||||||||
plug_ssl = Plug.SSL.init(host: force_ssl_host) | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also think you can do something like this:
And then skip the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What should I do with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is no longer used as we renamed it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got it! |
||||||||||||||||||||
Plug.SSL.call(conn, plug_ssl) | ||||||||||||||||||||
else | ||||||||||||||||||||
conn | ||||||||||||||||||||
end | ||||||||||||||||||||
end | ||||||||||||||||||||
|
||||||||||||||||||||
def access_struct_url() do | ||||||||||||||||||||
base = | ||||||||||||||||||||
case struct_url() do | ||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, maybe there was some confusion. We don't need LIVEBOOK_FORCE_SSL anymore, only LIVEBOOK_FORCE_SSL_HOST. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've solved it.