I want to remove the CORS Headers - Access-Control-Allow-Origin & Access-Control-Allow-Methods from API Connect Response for an API.
I tried the following methods in the assembly but they didnt work.
Javascript :
hm.current.remove('Access-Control-Allow-Origin');
XSLT:
<dp:remove-http-response-header name="Access-Control-Allow-Origin"/>
I also tried the global post response hooks policy but that also didnt help. The assembly for the policy is as follows:
assembly:
execute:
- set-variable:
version: 1.0.0
title: Remove Access Control Haders
actions:
- clear: message.headers.access-control-allow-origin
- clear: message.headers.access-control-allow-methods
Pleaset let us know how to remove them if the CORS is enabled in an API. I have been trying to work on extensions but getting my existing policy hasnt been easy.
------------------------------
Kshitij Khanna
------------------------------