302 Redirect not working from Web API when invoked via Integration in a Dynamic Link
Hi everyone,
I am trying to implement a seamless "Audit and Redirect" feature across different Appian sites in the same environment. As a developer, I do not have direct access to all the target sites, so I am storing their URLs dynamically in a database lookup table.
My Current Approach:
- From an interface, the user clicks a link component.
- This invokes an Integration object that calls a custom POST Web API.
- The Web API triggers
a!startProcess()to write the audit data to a table. - Upon process start (
onSuccess), the Web API attempts to perform a HTTP 302 redirect by passing the target lookup URL into theLocationheader.
The Issue:
The audit data is successfully captured in the database table every time. However, the browser does not redirect the user to the target URL, and the user remains on the same page.
Here is a snippet of my Web API onSuccess configuration:
onSuccess: a!httpResponse(
statusCode: 302,
headers: {
a!httpHeader(
name: "Location",
value: http!request.headers.url /* Dynamic URL retrieved from context */
)
},
body: if(
a!isNotNullOrEmpty(fv!processInfo),
a!toJson(fv!processInfo),
null()
)
)
