Starting from 19.4.3, Visual Builder gives you more control on how to connect to REST APIs using Service Connections, specifically in the area of CORS (Cross Origin Request Sharing).
As pointed out in an older blog post, VB can connect to external REST APIs in two ways
These are represented in the below figure:
Previously, this option was controlled through what was set as an authentication method, plus a checkbox known as the "Token Relay" at the service connection. These have now been standardized and made available as an attribute called the "Connection Type" next to the authentication in the Server settings of the Service Connection (or Backend)
These values that the Connection type attribute can take are :
The Dynamic options are the recommended options, where Visual Builder best decides the route to chart from the app to the external service (i.e. whether to go directly or via Proxy), based on whether the service supports CORS or not. However, you can always choose the third option (Always use the Proxy) and make sure that all requests are routed via the Proxy.
Phew, those are a lot of things to check! Fortunately, you don't have to check any of these yourself when you opt for "Dynamic" with the relevant CORS option and VB automatically figures out whether to use "Direct" or "Proxy"
If you are unsure about the CORS status of the API you want to connect to, you can try testing it in the Test tab which will report if you are unable to use the "Dynamic - supports CORS" option. In this case, the next best choice is using the "Dynamic - doesnt support CORS" option.
And if for some reason, you always want to route your request through the VB proxy, that is available too with the choice of "Always Use Proxy"
VB will decide the route of communication with the REST API with Dynamic connection types based on the following parameters
Here is a diagram showing how VB decides which option is the most optimal during runtime:
The advantage of the new Connection Type attribute is that the developer doesn't have to decide the choice upfront - VB does it for you. The developer simply has to indicate whether or not the REST resource being connected to supports CORS for this particular VB domain. Ofcourse, the developer also has the flexibility of completely ignoring the optimality algorithm and always route requests through the proxy by using the "Always use Proxy" option