mirror of
https://github.com/caddyserver/website.git
synced 2025-06-15 10:44:44 -04:00
more explained
This commit is contained in:
parent
d5429515d3
commit
b1cd29518f
1 changed files with 3 additions and 1 deletions
|
@ -100,7 +100,9 @@ func (g *Gizmo) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
|
||||||
|
|
||||||
#### Resolve the placeholder during Match or Serve
|
#### Resolve the placeholder during Match or Serve
|
||||||
|
|
||||||
In order to now correctly read our `g.Name` placeholder, in a plugin matcher or middleware, we must extract the replacer from the context, and use that replacer on our saved placeholder string.
|
In order to now correctly read our `g.Name` placeholder in a plugin matcher or middleware, we must extract the replacer from the context and use that replacer on our saved placeholder string.
|
||||||
|
|
||||||
|
This gives us a string with all valid replacements done, which we can then use in whichever way we want. In the example, we write those bytes to output
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (g *Gizmo) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error {
|
func (g *Gizmo) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue