Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Angel <[email protected]>
  • Loading branch information
cloudjumpercat and Guaris authored Dec 18, 2024
1 parent 1f69366 commit 7165bbc
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Dynamically rewrite simple request URLs with {{site.base_gateway}} Routes
title: Rewrite simple request URLs with {{site.base_gateway}} Routes
content_type: how_to
related_resources:
- text: Routes
Expand Down Expand Up @@ -38,11 +38,11 @@ tags:

tldr:
q: How can I divert traffic from an old URL to a new one with {{site.base_gateway}}?
a: Set up a Gateway Service with the old URL path and create a new a Route with new path.For example, your legacy upstream endpoint may have a base URI like `/api/old/`. However, you want your publicly accessible API endpoint to now be named `/new/api`. To route the Service’s upstream endpoint to the new URL, you can set up a Service with the path `/api/old/` and a Route with the path `/new/api`.
a: Create a new route and point it to the existing Gateway Service. The new route will proxy traffic to the existing service at the new URL.

faqs:
- q: My URLs are more complex, such as replacing `/api/<function>/old` with `/new/api/<function>`, what should I use instead to rewrite them?
a: You can use the [Request Transformer plugin](/hub/request-transformer/) for a complex URL rewrite or the [expressions router](/gateway/routing/expressions/) ({{site.base_gateway}} 3.0.x or later) to describe Routes or paths as patterns using regular expressions.
a: You can use either the [Request Transformer plugin](/hub/request-transformer/) or the [expressions router](/gateway/routing/expressions/) for complex URLs.

cleanup:
inline:
Expand All @@ -63,7 +63,6 @@ entities:
services:
- name: example-service
url: http://httpbin.konghq.com/anything
path: /anything
append_to_existing_section: true
{% endentity_examples %}

Expand Down

0 comments on commit 7165bbc

Please sign in to comment.