I set up an API which accept a custom domain consist of only two subdomains for example:
‘{subdomain:(?:test|test2)}.example.com’ which accepts only: test and test2
in my endpoint designer I want to rewrite the path to different url for these two domains so for example if I got ‘test’ I want it to be rewrite to ‘test-rewrite.example.com’ and if I got
‘test2’ I want it to be rewrite to ‘test2-rewrite.example.com’
I tried Advanced URL Rewrite but I couldn’t manage how to properly set it
You could write a custom plugin to look at the requested server name and inject it as a header ? That way your URL rewrite could have access to that header and write to an API depending on its value.
Here’s a line in a “pre” Go plugin that injects the requested Host name as a header: