Ooops. Just reread that. OK, the reason the browser times out is so the user doesn't get locked up is the server goes down. You HAVE to respond in a reasonable time, for the user's sake.
If the process takes longer than that interval,
you should pass it off to another (asynchronous) task on the server, THEN use the "wait" mechanism to keep the connection alive, and have the web server check the progress of the process server.
The reason you need a "wait" page is that a web server CAN'T "push" output, only respond to requests, so you just keep sending requests until there's output available. In some cases, you may want to display that output incrementally, as it becomes available, in which case just pass it back as part of the "wait" page. Not the most beautiful solution in the world, I admit, but the only one I know of that works in the general http world.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.