Azure web app has a default setting of request timeout at 230 seconds. we have an API which serves customer query, so its time depends on the customers query input. if the query is simple, API will return in few ms, if query is complex it takes more time. sometimes it takes more than 230 second, so the request get timed out and return 500. our requirement is to return 408 time out error code, when it takes more than 230 second. is there any way to configure that?
so our concern is not about time out, but about the error code, we need to return 408 instead of 500 after 230 sec
Azure web app has a default setting of request timeout at 230 seconds. we have an API which serves customer query, so its time depends on the customers query input. if the query is simple, API will return in few ms, if query is complex it takes more time. sometimes it takes more than 230 second, so the request get timed out and return 500. our requirement is to return 408 time out error code, when it takes more than 230 second. is there any way to configure that? so our concern is not about time out, but about the error code, we need to return 408 instead of 500 after 230 sec
According to this MS Q & A answer by Venkatesh Dodda.
You can add a Custom Error page as
408.html
in your Website > wwwroot And edit yourweb.config
to fetch the 408.html custom error page during timeout.I added 408.html page in my Azure Web app > Advanced Tools > Go > Kudu > Tools > Zip push deploy > And added one File with 408.html name and code like below:-
Edited web.config with the path set to the 408.html file like below:-
web.config:-
As an alternative, You can Upgrade your Web app to Premium plan and make use of custom Error pages preview feature. As this Feature is still in Preview you can only edit
403, 502, 503
Error pages as 408 is not supported yet, Refer below:-Another alternative is to create a 408.html page in your Local Web app and then Add the path to the folder in web.config.