Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

408 RequestTimeout not rendering any error page #1396

Open
beesanne opened this issue Sep 20, 2024 · 1 comment
Open

408 RequestTimeout not rendering any error page #1396

beesanne opened this issue Sep 20, 2024 · 1 comment

Comments

@beesanne
Copy link

beesanne commented Sep 20, 2024

Not sure if I'm just missing something here but I am trying to set a custom error page for when it times out but right now its just returning a blank page with or without the custom page set up.

I am on Pode version - 2.10.1

I have a 408.json file inside of /errors:
{"Response": "Operation took too long"}

server.psd1 has:
Web = @{ ErrorPages = @{ ShowExceptions = $true Default = "application/json" StrictContentTyping = $true } }

when i force a timeout by setting the request to 5 second timeout i would expect it to return a 408 error (which it does) and then render the error page (which it does not). I have tried this with a 404 error by typing in a route that does not exist and it does automatically return the custom 404 error. Do 408 errors not work this same way or am i just doing something wrong?

@Badgerati
Copy link
Owner

For 408 this is expected, the handling of the timeout is done further up the stack within the .NET code, rather than within the PowerShell code so it's difficult to handle and send back the customised response. When the timeout occurs, it's handled by a separate process which terminates the current thread, and forces a 408 response back to the client.

There are a couple other HTTP status codes which are the same, typically 5XX ones. They're handled further up the stack and it's difficult to customise the response.

I'll have a think, in case there's anything I can do with 408s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants