From 61e3c39ecde189634d6f89863538d72e612b25e9 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Wed, 18 Jul 2018 19:29:03 -0500 Subject: [PATCH] Add 'secure' for cookies when SSL enabled --- src/invidious.cr | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/invidious.cr b/src/invidious.cr index 39f8a2a8..fe205b53 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -663,7 +663,12 @@ post "/login" do |env| host = URI.parse(env.request.headers["Host"]).host login.cookies.each do |cookie| - cookie.secure = false + if Kemal.config.ssl + cookie.secure = true + else + cookie.secure = false + end + cookie.extension = cookie.extension.not_nil!.gsub(".youtube.com", host) cookie.extension = cookie.extension.not_nil!.gsub("Secure; ", "") end