Skip to content

Commit

Permalink
Merge pull request #284 from ochan1/cookie_samesite_lax_chromium
Browse files Browse the repository at this point in the history
Change SameSite to Lax during Development in app.lua
  • Loading branch information
cycomachead committed Jul 27, 2021
2 parents aa8bbb7 + a712c58 commit 3ac5c48
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 0 additions & 6 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ $ git clone --recursive https://github.com/bromagosa/snapCloud.git

## Development

### NOTE: Browser Selection for Cookies to work

Chromium-based browsers will not save the cookies of your login session during the development of Snap!Cloud. They will work on the deployed wesite.

As a result, it is recommended to use Firefox or Safari to load pages during development, and never Chromium browsers (Chrome, Opera, New Microsoft Edge, etc.).

### Steps to look into

When developing on Snap!Cloud on your local machine, the following sections are important:
Expand Down
9 changes: 7 additions & 2 deletions app.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,13 @@ require 'responses'
-- Make cookies persistent
app.cookie_attributes = function(self)
local expires = date(true):adddays(365):fmt("${http}")
local secure = config._name ~= 'development' and " Secure" or ""
return "Expires=" .. expires .. "; Path=/; HttpOnly; SameSite=None;" .. secure
local secure = " " .. "Secure"
local sameSite = "None"
if (config._name == 'development') then
secure = ""
sameSite = "Lax"
end
return "Expires=" .. expires .. "; Path=/; HttpOnly; SameSite=" .. sameSite .. ";" .. secure
end

-- Remove the protocol and port from a URL
Expand Down

0 comments on commit 3ac5c48

Please sign in to comment.