From a3279b8fa92868dacdff105e47f23a6b663ca720 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sat, 29 Aug 2020 18:15:22 +0300 Subject: [PATCH] add a note on rewrite middleware for local URL modifications --- _examples/routing/rewrite/main.go | 3 ++- _examples/routing/rewrite/redirects.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/_examples/routing/rewrite/main.go b/_examples/routing/rewrite/main.go index 62bec59b..9050e0d3 100644 --- a/_examples/routing/rewrite/main.go +++ b/_examples/routing/rewrite/main.go @@ -31,7 +31,8 @@ func main() { // http://localhost:8080/docs/v12some -> http://localhost:8080/docs // http://localhost:8080/oldsome -> http://localhost:8080 // http://localhost:8080/oldindex/random -> http://localhost:8080 - // http://localhost:8080/users.json -> http://localhost:8080/users?format=json + // http://localhost:8080/users.json -> http://localhost:8080/users.json + // ^ (but with an internal ?format=json, client can't see it) app.Listen(":8080") } diff --git a/_examples/routing/rewrite/redirects.yml b/_examples/routing/rewrite/redirects.yml index 63b68290..546baccf 100644 --- a/_examples/routing/rewrite/redirects.yml +++ b/_examples/routing/rewrite/redirects.yml @@ -12,7 +12,7 @@ RedirectMatch: # REDIRECT_CODE_DIGITS | PATTERN_REGEX | TARGET_REPL - 301 ^(http|https)://test.(.*) $1://newtest.$2 # Handles /*.json or .xml as *?format=json or xml, - # without redirect. See /users route. + # WITHOUT redirect. See /users route. # When Code is 0 then it does not redirect the request, # instead it changes the request URL # and leaves a route handle the request.