Solved Allow redirecting common HTTP codes
-
I'd like to request that we allow certain HTTP codes to be redirected to certain files if they exist:
Example:
If 404 (file not found) and my little website has a 404.html, it should use that instead of the surfer default.
-
@murgero Can this be accomplished with a bit of JS in the page?
Otherwise it may make sense to use something like caddy2 which has a host of other features and configuration options.
-
Good idea. Do you think some convention is good enough? Like as you said if the document root contains a file of the name schema
<statucode>.htm(l)
, surfer should deliver that?This would not require any further UI and settings.
-
@nebulon yes that would be a good approach, as it would immediately be compatible with some static site builders such as Hugo.
-
@nebulon Yes I like that approach. Or maybe a settings page that has the ability for admins to specify a file for each status code. They can give the status code they want to redirect for and the file to redirect to.
Certain status codes should be ignored however: Specifically:- 100
- 101
- 102
- 103
- 200
- 201
- 202
- 203
- 205
- 206
- 207
- 208
- 226
Can this be accomplished with a bit of JS in the page?
No as what I am asking for happens before a page is loaded, not after.
-
For a start this really only applies to
404.html
as far as I can tell. -
@nebulon I would do Status codes 4XX to cover most client-side status codes to start
-
This is now fixed with version 5.15.0
I only added support for 404 pages for now, since this is the only 4* error code the app would publicly serve up anyways.
-
@nebulon I can confirm the update works very well - Thank you!