How to use a variable in a HTTPTargetConnection URL?

Is there a way to refer to a variable in the URL for the HTTPTargetConnection? We have a LoadBalance rconfig instead of a URL but it would still be nice if there was a way to display what one of the URLs might be, so that people trying to troubleshoot a proxy don't have to go digging through the proxy source code to figure it out.

If we use a LoadBalancer config, the target column on the proxy Overview page just displays "none" which makes life very much not worth living for anyone having to work with such a proxy 😓

Solved Solved
1 4 296
1 ACCEPTED SOLUTION

You'll be overriding the LoadBalancer configuration with this pattern. If the hostname portion of your URLs will not change, then don't set `target.url`, set `target.copy.pathsuffix` as `false`, and finally set your dynamic path using a message template like this:

<HTTPTargetConnection>
        <LoadBalancer>
            <Server name="static_target_server"/>
        </LoadBalancer>        
        <Path>/v1/{dynanmic_path}</Path>
    </HTTPTargetConnection>  

View solution in original post

4 REPLIES 4

You can't use message templates in the HTTPTargetConnection URL element value, but you can use the dynamic target pattern and set the URL using variables populated from a KVM, property sets, templates, etc.

If we set the URL, is that going to conflict with the LoadBalancer config? It's nice to be able to see a URL in the Apigee overview rather than just "none" but if adding one is going to cause problems with the LoadBalancer, I guess I'll have to live with "none".

You'll be overriding the LoadBalancer configuration with this pattern. If the hostname portion of your URLs will not change, then don't set `target.url`, set `target.copy.pathsuffix` as `false`, and finally set your dynamic path using a message template like this:

<HTTPTargetConnection>
        <LoadBalancer>
            <Server name="static_target_server"/>
        </LoadBalancer>        
        <Path>/v1/{dynanmic_path}</Path>
    </HTTPTargetConnection>  

Thank you. I'm pretty new to Apigee and probably won't change anything yet, but it's good to know the options available.