vishakhr okay that might be an older version of SwaggerUI.
The current stable version is 3.52.3, with 4.0.0-rc (release candidate) becoming stable soon.
There is also no timeout functionality that I'm aware of in the new versions (version 2.x is so old, I can't recall that at all). But the docker container uses nginx which does have a timeout (which is why I asked). Also 504 isn't a browser error but a server error, so it's a server component somewhere in the chain of things.
Try update to the latest version of SwaggerUI to see if that helps.
Else look at the network logs in the browser to see the request being made, and double check to see if it matches the request being made by Postman (or cURL).