Support URL replacement in errors middleware
This commit is contained in:
parent
7d274e8088
commit
ae6e844143
3 changed files with 51 additions and 23 deletions
|
@ -93,6 +93,7 @@ func (c *customErrors) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
|||
if len(c.backendQuery) > 0 {
|
||||
query = "/" + strings.TrimPrefix(c.backendQuery, "/")
|
||||
query = strings.ReplaceAll(query, "{status}", strconv.Itoa(code))
|
||||
query = strings.ReplaceAll(query, "{url}", url.QueryEscape(req.URL.String()))
|
||||
}
|
||||
|
||||
pageReq, err := newRequest("http://" + req.Host + query)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue