Most likely it is a server issue. The BIG-IP will not send HTTP and HTTP response codes in case something is wrong with the backend or with the config.
You can easily take a tcpdump on the BIG-IP and trace under which condition the backend server sends the 504 HTTP status.
so normally what is the cause of this response code ? does this due to The application takes longer to respond than the configured idle timeout?
So do I have to check anything from server side?
for bigip i will try tcpdump and will check the logs.
Thanks in advance.
504 Gateway Timeout is explained here.
"The HyperText Transfer Protocol (HTTP) 504 Gateway Timeout server error response code indicates that the server, while acting as a gateway or proxy, did not get a response in time from the upstream server that it needed in order to complete the request."
Are you load balancing to some other kind of reverse proxy? Apache, NGINX?