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

Cookie session problem #689

Open
mobilemindtec opened this issue Nov 2, 2019 · 5 comments
Open

Cookie session problem #689

mobilemindtec opened this issue Nov 2, 2019 · 5 comments

Comments

@mobilemindtec
Copy link

Hi,

I'm have problemas with cookie session:

ENV OTP_VERSION 20.3
ENV CHICAGOBOSS_VERSION 0.9-beta2
    {session_adapter, mock},
    {session_key, "_boss_session"},
    {session_exp_time, 525600},
    {session_cookie_http_only, true},
    {session_cookie_secure, false},
    {session_enable, true},

The cookie is being created in a strange way as shown:

Image problem

What could be wrong? Thanks!

@Shpaky
Copy link

Shpaky commented Dec 10, 2020

HI!
Did you solve the problem?

@Shpaky Shpaky mentioned this issue Dec 10, 2020
@mobilemindtec
Copy link
Author

Hi,

I had to use version 1.9 of erlang to work.

@mobilemindtec
Copy link
Author

mobilemindtec commented Mar 18, 2021

Hi,

No, I'm use only boss_session:set_session_data(SessionID, logged_user, User). boss_web_controller_handle_request uses mochiweb_cookies:cookie. This is the problem?

boss_web_controller_handle_request:add_session_to_headers

add_session_to_headers(Req, Headers, SessionID) ->
    SessionExpTime    = boss_session:get_session_exp_time(),
    CookieOptions    = [
                        {domain, boss_env:get_env(session_domain, undefined)},
                        {path, "/"},
                        {max_age, SessionExpTime},
                        {secure, boss_env:get_env(session_cookie_secure, false)},
                        {http_only, boss_env:get_env(session_cookie_http_only, true)}
                       ],
    SessionKey        = boss_session:get_session_key(),
    lists:merge(Headers, [mochiweb_cookies:cookie(SessionKey, SessionID, CookieOptions)]).




@mobilemindtec
Copy link
Author

boss add set-cookie in headers, but on new version of cowboy need set in Res#response.cookies. Right?

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