Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Can't set TLS/SSL values dynamically in JavaScript policy

I'm trying to set TLS/SSL details dynamically in a Javascript policy that's used in Shared flow, as described in the docs: 
https://cloud.google.com/apigee/docs/api-platform/reference/api-proxy-configuration-reference#tlsssl.... Specifically, I'm setting 
<SSLInfo>
   
<Enabled>{myvars.ssl.enabled}</Enabled>
When invoking the Proxy I keep getting 500 error:
{
    "fault": {
        "faultstring""Target connection failed",
        "detail": {
            "errorcode""entities.DynamicSSLEvaluationFailed"
        }
    }
}
I'm setting myvars.ssl.enabled in the beginning of my JS file:
context.setVariable('myvars.ssl.enabled'true);
but it seems in the DEBUG that it's not populated. Could you suggest how to set it dynamically?
Solved Solved
0 9 532
2 ACCEPTED SOLUTIONS

Thanks for the quick response, Dino. We don't plan to turn TLS off completely, so I guess setting 'Enabled' to 'true' will work just fine. Just wanted to make sure we had the flexibility to manage it programmatically if required, in some really rare use case. Appreciate the help on this.

The way the variable was set was like this and it showed up as blank even though verifyapikey.VA-Verify-API-Key.ssl_enabled has the value 'true' in it.

var sslEnabled = context.getVariable("verifyapikey.VA-Verify-API-Key.ssl_enabled");
context.setVariable("sslEnabled" , sslEnabled);

View solution in original post

Just confirming the variable had a typo due to which the value fetched was being set to 'null' and hence nothing in context.setVariable("sslEnabled" , sslEnabled);

All good now.

View solution in original post

9 REPLIES 9