Open up the Network tool on Firefox or Chrome. When you get to the page that let's you click continue, watch the window.

On Firefox it's Tools -> Web Dev -> Network.
On Chrome it's More Tools -> Developer Tools -> Network tab.

You will need to refresh the page so it can start monitoring.

Now once the initial page loads and you see your cart, click continue. Look for shipping.html, userinfo.html, and payment.html (iirc) to appear at the bottom. On Firefox it will start as a grey dot, this means it's connecting. If it completes it will turn green and the page will load, otherwise it will turn purple and say it 504ed. If this happens, click the previous title on the top black bar to go back (the back button won't be available) and try again until it goes green.

This way you don't need to start from the beginning and don't have to wait for the error to appear (the gateway timeout is basically instant, but the error takes forever to appear).

Good luck!