# Tryton 7 Session Expiration Issue

**URL:** https://discuss.tryton.org/t/tryton-7-session-expiration-issue/9338
**Category:** System Administrator
**Created:** [August 24, 2026, 6:56am UTC](https://discuss.tryton.org/t/tryton-7-session-expiration-issue/9338 "2026-08-24T06:56:26Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![asifrana](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/a/5fc32e/32.png) [@asifrana](https://discuss.tryton.org/u/asifrana)
#### Post date: [August 24, 2026, 6:56am UTC](https://discuss.tryton.org/t/tryton-7-session-expiration-issue/9338/1 "2026-08-24T06:56:27Z")

</div>

I am using **GNU Health 5.0 with Tryton 7**. I have configured the session to expire after **3 minutes of inactivity**. However, the session expiration is not working consistently.

In some cases, I receive a **Gateway Error** , while in other cases, when I am actively working in the system, it unexpectedly asks me to enter my password again.

Could you please help me identify the cause of this issue and advise how to properly configure the **Tryton session timeout** so that it works consistently without causing Gateway Errors or unexpected password prompts?

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [August 24, 2026, 9:48am UTC](https://discuss.tryton.org/t/tryton-7-session-expiration-issue/9338/2 "2026-08-24T09:48:56Z")

</div>

> [@asifrana](#):
>
> I am actively working in the system, it unexpectedly asks me to enter my password again.

When the system asks your password again means that the session has expiered. So it seems the session is expiration is working.

> [@asifrana](#):
>
> In some cases, I receive a **Gateway Error** ,

The gateway error probably is because you have a proxy in front of tryton and the proxy is unable to contact the server.

That’s what I can see with your setup. Unless you share more details about your setups and logs of the errors we can not provide more help.

Also It will be great what you want to achieve with the 3 minutes timeout.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [August 24, 2026, 10:07am UTC](https://discuss.tryton.org/t/tryton-7-session-expiration-issue/9338/3 "2026-08-24T10:07:09Z")

</div>

> [@asifrana](#):
>
> unexpected password prompts

If you are talking about the configuration `[session] timeout` is about the freshness of the session. This is checked only for specific actions. So this can be the reason for your un-expectation.

Now if you have setup `[session] max_age` then you must adapt `[session] timeout` to be lower in order to have effect.

Also remember that the freshness of a session is based on the requests performed to the server. If the client is “used” but does not trigger any server request, these actions are not refreshing the session.

---

<div class="post-metadata">

### Author: ![asifrana](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/a/5fc32e/32.png) [@asifrana](https://discuss.tryton.org/u/asifrana)
#### Post date: [August 24, 2026, 10:15am UTC](https://discuss.tryton.org/t/tryton-7-session-expiration-issue/9338/4 "2026-08-24T10:15:51Z")

</div>

> [@pokoli](#):
>
> When the system asks your password again means that the session has expiered. So it seems the session is expiration is working.

Session refresh time is 10 minutes, so it ask password after 10 minutes .  
I want to configure the system so that if a user remains **idle for 10 minutes** , the session should expire or require the user to **enter their password again**.

The password prompt should occur only after **10 minutes of inactivity** and should not interrupt users while they are actively working in the system.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [August 24, 2026, 10:26am UTC](https://discuss.tryton.org/t/tryton-7-session-expiration-issue/9338/5 "2026-08-24T10:26:47Z")

</div>

To achieve that you must modify all the `RPC` definitions to set [`fresh_session`](https://docs.tryton.org/latest/server/ref/rpc.html#trytond.rpc.RPC.fresh_session) to `True` and set `[session] timeout` to 10min.  
By default Tryton set it only for important operation like posting an invoice or approve a payment.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [August 24, 2026, 1:00pm UTC](https://discuss.tryton.org/t/tryton-7-session-expiration-issue/9338/6 "2026-08-24T13:00:02Z")

</div>

> [@ced](#):
>
> To achieve that you must modify all the `RPC` definitions to set [`fresh_session`](https://docs.tryton.org/latest/server/ref/rpc.html#trytond.rpc.RPC.fresh_session) to `True`

You can achieve that by registering a mixin on the Model, Wizard and Report classes.

Something like this (untested code):

```python
from trytond.model import Model
from trytond.wizard import Wizard
from trytond.report import Report
from trytond.pool import Pool

class FreshSessionMixin:
    __slots__ = ()

    @classmethod
    def __setup__ (cls):
        super(). __setup__ ()
        for rpc in cls. __rpc__.values():
            rpc.fresh_session = True

def register():
    Pool.register_mixin(
        FreshSessionMixin, Model, module='yourmodule')
    Pool.register_mixin(
        FreshSessionMixin, Wizard, module='yourmodule')
    Pool.register_mixin(
        FreshSessionMixin, Report, module='yourmodule')

```
