I have some custom connectors that connect to a reverse proxy via on-premises gateway. The Base URL defined in each custom connector is used by the reverse proxy to redirect the request to the right endpoint. The Base URL value defined in the custom connector is the only thing unique to each custom connector. The custom connectors work fine.
To reduce the number of custom connectors, I want to be able to have just one custom connector where I pass the environment name as a header parameter and have it update the URL accordingly. I have tried using the ‘set host URL’ policy but I cannot get it to work.
Here is the configuration (names changed for privacy) I have:
Existing custom connector 1 – works ok
- Connect via on-premises data gateway enabled
- Scheme: HTTP
- Host: myhost
- Base URL: /env1
Existing custom connector 2 – works ok
- Connect via on-premises data gateway enabled
- Scheme: HTTP
- Host: myhost
- Base URL: /env2
New custom connector – not working
- Connect via on-premises data gateway enabled
- Scheme: HTTP
- Host: myhost
- Base URL: /
The policy I have created on the new custom connector is:
- Template: Set host URL
- Applies to all operations
- URL Template: http://myhost/@headers(‘env’)
On requests, I am passing a header called ‘env’ with value set to either ‘env1’ or ‘env2’
When I test the connector I get a 500 response with "The remote name could not be resolved: myhost"
Does anyone have a suggestion on how I can get this working?
I think I may have found the answer to my own question. I just noticed this line in the documentation:
"Note that this policy currently does not support Gateway urls."