How to Extend Session Time With Separate Proxy and Hub Down?

Hi, I am trying to run the configurable-http-proxy separately to the hub using the information from this page.

I have it running and am able to access the hub and spin up new notebooks without issue. However, once I test taking the hub down with an active notebook it works as I’d expect for a few minutes.

About 5 minutes after taking down the hub I can continue to use the kernels, terminals and other tabs I have running, however, I am no longer able open new ones. Similarly, if I try to close the browser tab and reopen it I just get a blank screen.

At the same time I see the following message in the logs:

HubAuth cache miss: token:<redacted>

That led me to the following page under the assumption it was authentication issue.

I tried adjusting some of the cache settings with no luck. I understand that this 5 minute timeout is in place for a reason but was wondering if there is a way to extend it slightly?

Yes, in the single-user environment (e.g. /etc/jupyter/ in your single-user machine/image), set:

c.HubAuth.cache_max_age = 600 # 10 minutes

This will be loaded as the single-user server is starting up.

This number essentially reflects the amount of downtime of the Hub active single-user servers can handle (the clock starts ticking at last check, not when the hub goes down, so you can still be unlucky and fail immediately, and the average time is half this cache age).