Rewrites

Once Ambassador Edge Stack uses a prefix to identify the service to which a given request should be passed, it can rewrite the URL before handing it off to the service. By default, the prefix is rewritten to /, so e.g., if we map /prefix1/ to the service service1, then

http://ambassador.example.com/prefix1/foo/bar

would effectively be written to

http://service1/foo/bar

when it was handed to service1.

You can change the rewriting: for example, if you choose to rewrite the prefix as /v1/ in this example, the final target would be:

http://service1/v1/foo/bar

And, of course, you can choose to rewrite the prefix to the prefix itself, so that

http://ambassador.example.com/prefix1/foo/bar

would be "rewritten" as:

http://service1/prefix1/foo/bar

Ambassador Edge Stack can be configured to not change the prefix as it forwards a request to the upstream service. To do that, specify an empty rewrite directive:

  • rewrite: ""

For more information on how rewrite and prefix can be configured, see Mappings.

Questions?

We’re here to help. If you have questions, join our Slack or contact us.