Hostname Rewrite from Middlewares


I’m wondering if it is possible to set the URL Rewrite for the downstream host from the middleware? Specifically, coprocess GRPC middleware.

We have a pretty hacky solution right now, where our middleware sets a session metadata token like so:

Session.Metadata = "{new_host:}"

And then our URL rewrite config uses tyk contexts:

“url_rewrites”: [{
“path”: “/”,
“method”: “GET”,
“match_pattern”: “”,
“rewrite_to”: “http://$tyk_meta.new_host”

But we think there should be a simpler solution to override host from plugins.

1 Like