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

docs: Add error caddyfile directive #143

Merged
merged 1 commit into from
Apr 16, 2021
Merged

docs: Add error caddyfile directive #143

merged 1 commit into from
Apr 16, 2021

Conversation

francislavoie
Copy link
Member

Docs for the new directive in caddyserver/caddy#4034.

Also adding a bit in handle_errors mentioning that reverse_proxy doesn't trigger errors when a response has an "error" HTTP status; not sure how to word this clearly, cause reverse_proxy still can trigger errors if there's no upstream or whatever. We should probably add examples for that later, and augment this paragraph to mention handle_response once that's merged (caddyserver/caddy#4021)

Docs for the new directive in caddyserver/caddy#4034.

Also adding a bit in `handle_errors` mentioning that `reverse_proxy` doesn't trigger errors when a response has an "error" HTTP status; not sure how to word this clearly, cause `reverse_proxy` still can trigger errors if there's no upstream or whatever. We should probably add examples for that later, and augment this paragraph to mention `handle_response` once that's merged (caddyserver/caddy#4021)
@francislavoie francislavoie added the documentation Improvements or additions to documentation label Mar 14, 2021
@francislavoie francislavoie requested a review from mholt March 14, 2021 20:48
@@ -8,7 +8,12 @@ Sets up error handlers.

When the normal HTTP request handlers return an error, normal processing stops and the error handlers are invoked. Error handlers form a route which is just like normal routes, and they can do anything that normal routes can do. This enables great control and flexibility when handling errors during HTTP requests. For example, you can serve static error pages, templated error pages, or reverse proxy to another backend to handle errors.

A request's context is carried into error routes, so any values set on the request context such as [site root](/docs/caddyfile/directives/root) will be preserved in error handlers, too. Additionally, new placeholders are available when handling errors. [The JSON docs for an HTTP server's error routes](/docs/json/apps/http/servers/errors/#routes) describe these placeholders. The `handle_errors` directive simply adds error routes, so you can use those placeholders within a `handle_errors` block.
A request's context is carried into error routes, so any values set on the request context such as [site root](root) will be preserved in error handlers, too. Additionally, new placeholders are available when handling errors. [The JSON docs for an HTTP server's error routes](/docs/json/apps/http/servers/errors/#routes) describe these placeholders. The `handle_errors` directive simply adds error routes, so you can use those placeholders within a `handle_errors` block.
Copy link
Member Author

@francislavoie francislavoie Mar 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only change on this line is shortening the link in [site root](root), github doesn't make that obvious

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks as usual! Really appreciate all your help with the docs.

@mholt mholt merged commit 9dc0156 into caddyserver:master Apr 16, 2021
@francislavoie francislavoie deleted the error-directive branch April 16, 2021 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants