I had noticed earlier that the 504 is occurring less when you're not logged in, so last time it happened I connected via another browser, with which I had not logged in yet. And there I got the forum list immediately. So probably slowness or overload in the DB, connected to the membership data. Not the web server.
Edit : I redid the test just now, but this time I also got 504's while not logged on. It got repaired just a few minutes earlier than with the autologon browser. So it's not so clearcut after all.