logout session clean #2662

Closed
opened 2025-11-02 04:43:49 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @evalor on GitHub (Dec 14, 2018).

  • Gitea version (or commit ref): Gitea version 1.6.1 built with: bindata, sqlite
  • Git version: git version 1.8.3.1
  • Operating system: Centos 7.4
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Now I use nginx to forward requests to gitea, the configuration as follows:

server
{
    listen 80;
    server_name xxx.cn; # this is sample domain
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/gitea;
    location / 
    {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header REMOTE-HOST $remote_addr;

        expires 12h;
    }
}

When I logged in and clicked the logout button, nginx caches requests( Status Code: 302 Found (from disk cache) ), cause not to receive the correct response header, the 'set-cookie' response header miss so I can still operate normally.

When I look at the folder 'data/sessions', user session still exists, is this normal or should the session be cleared when the user exits?

Because my English level is limited, I use Google Translator. If there is something unclear, please tell me that I am willing to assist in the recurrence of the problem.

...

Originally created by @evalor on GitHub (Dec 14, 2018). - Gitea version (or commit ref): Gitea version 1.6.1 built with: bindata, sqlite - Git version: git version 1.8.3.1 - Operating system: Centos 7.4 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: ## Description Now I use nginx to forward requests to gitea, the configuration as follows: ```ini server { listen 80; server_name xxx.cn; # this is sample domain index index.php index.html index.htm default.php default.htm default.html; root /www/wwwroot/gitea; location / { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; expires 12h; } } ``` When I logged in and clicked the logout button, nginx caches requests( Status Code: 302 Found (from disk cache) ), cause not to receive the correct response header, the 'set-cookie' response header miss so I can still operate normally. When I look at the folder 'data/sessions', user session still exists, is this normal or should the session be cleared when the user exits? Because my English level is limited, I use Google Translator. If there is something unclear, please tell me that I am willing to assist in the recurrence of the problem. ...
GiteaMirror added the type/enhancementtopic/security labels 2025-11-02 04:43:49 -06:00
Author
Owner

@zeripath commented on GitHub (Dec 20, 2018):

So I think this is normal. There's certainly no call to destory (sic) the session in the code. I think however there's some clean up process that will remove old sessions intermittently but I could be wrong in that.

@zeripath commented on GitHub (Dec 20, 2018): So I think this is normal. There's certainly no call to destory (sic) the session in the code. I think however there's some clean up process that will remove old sessions intermittently but I could be wrong in that.
Author
Owner

@zeripath commented on GitHub (Jan 11, 2019):

OK, I've finally looked again at go-macaron/session. https://github.com/go-gitea/gitea/blob/master/vendor/github.com/go-macaron/session/session.go#L352 describes the function:

func (m *Manager) startGC() {
	m.GC()
	time.AfterFunc(time.Duration(m.opt.Gclifetime)*time.Second, func() { m.startGC() })
}

Which causes the session store to clean out old sessions every m.opt.Gclifetime which is set at: 86400 seconds (1 day) by default in Gitea by 8d2c24f7f9/modules/setting/setting.go (L1501)

I think this issue can therefore be closed.

@zeripath commented on GitHub (Jan 11, 2019): OK, I've finally looked again at go-macaron/session. https://github.com/go-gitea/gitea/blob/master/vendor/github.com/go-macaron/session/session.go#L352 describes the function: ``` func (m *Manager) startGC() { m.GC() time.AfterFunc(time.Duration(m.opt.Gclifetime)*time.Second, func() { m.startGC() }) } ``` Which causes the session store to clean out old sessions every `m.opt.Gclifetime` which is set at: `86400` seconds (1 day) by default in Gitea by https://github.com/go-gitea/gitea/blob/8d2c24f7f9b9bce3a806e4748623bd3b2742025b/modules/setting/setting.go#L1501 I think this issue can therefore be closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2662