@Arild Bjerkenes , Just following-up, as Alan mentioned, the timeout is not configurable, and cannot be changed.
Just to highlight more on this, the 4-minute idle timeout on the TCP level and this is implemented on the Azure hardware load balancer. This timeout is not configurable, and this cannot be changed.
Note that the idle timeout is at the TCP level which means that if the connection is idle only and no data transfer happening, then this timeout is hit.
--Timeout will hit if the web application got the request and kept processing the request for > 4minutes without sending any data back.
Ideally, in a web application, it is not good to keep the underlying HTTP request open and 4 minutes is a decent amount of time.
A few things to try based on your requirement:
--If you have a requirement about background processing within your web application, then as Alan mentioned – the recommended solution is to use Azure WebJobs/or Azure Function App.
--For longer processing times, consider using the Durable Functions async pattern or defer the actual work and return an immediate response.
--I understand you have mentioned about KeepAlive implementation already-
--You could keep the connection active for a longer period is to use TCP Keep-alive. Packets are sent when no activity is detected on the connection. By keeping on-going network activity, the idle timeout value is never hit, and the connection is maintained for a long period. Try something like this:
• First request starts the script and returns an http 202
• Subsequent requests from client check the work, and eventually return 200 when it's done.
Checkout these reference discussion threads. Once again I understand you have looked into approachs for reimplementing the solution to tackle timeout. Kindly checkout the above and let us know if you have any further questions.