TLS Setup slowing down n8n when accessed from subdomain

Hi everyone. Just sharing an interesting problem and looking for suggestions.

I recently moved VPS provider. Since then, some executions on n8n are super delayed - i.e. after clicking execute, nothing happens for 1-2 minutes and then the workflow runs at a good speed.

Console shows that the delay is caused due to “TLS Setup”. My set up uses docker with a reverse nginx proxy (SWAG). The set up is identical to the set up my previous VPS had, but with upgraded versions of n8n and SWAG. See the POST request timings from FF Console in the screenshot below.

This only happens when I access n8n via my subdomain. There is no delay (i.e. the problem goes away) when I access n8n from my VPS’s IP and port number for n8n.

Any ideas what would cause this and how to fix? Possibly the problem is with SWAG rather than n8n but thought I would check here first because other containers that are using SWAG have no delay.

Hi @automatron, I’m really sorry to hear you’re running into this behaviour. To identify which of the components is causing the behaviour, could you confirm whether TLS termination is handled by n8n or by SWAG? Or in other words, in which of the two applications did you configure your SSL/TLS certificate?

Hey @MutedJam! It’s done by SWAG I believe.

Yes, it’s typically happening in the reverse proxy, just wanted to make sure. So in this case, SWAG would be the part to look at. If you run a quick search for “nginx slow tls handshake” you should get quite a few results to help start the investigation.


Cheers! I’ve just implemented a few tips from here: How Properly Configure Nginx Server for TLS | Hacker Noon

Will report back if I can confirm it has worked :slight_smile:

:tada: Update - seems to have worked! I followed points 6 to 8 from that article, making changes to the ssl.conf file.