Problem with letsencrypt

I am running next cloud on unraid. i run 2 extra dockers along with the nextcloud docker. the mariadb for the mysql database and letsencrypt for the ssl certificate
it used to work just fine but recently i started getting problems with letsencrypt.
it works fine when i connect to nextcloud with the ip of my device and the port but when i use my dynamic address it takes ages to load and sometimes I get 504 Gateway Time-out. when i try to login with my phone from the dynamic address i always get 504 Gateway Time-out