When we request to any function or Resource endpoint we get certain response headers as shown below
I need to change this header.
For Example, my function which is created in LAC only has a GET method than in the response header I should only have GET Method.
Same for Access-Control-Allow-Origin we need to have a specific domain and not the "*".
I have also seen the examples in response events which come with LAC5.0 in which we can customize the CORS, but how we can use them?
What is the best practice to handle this?
The CORS handling in LAC 5.0 is explained here:
We have tried the same in LAC5.0 but still i am facing the issue.
I have added the example and change the req.resourceName with the my resource name which i am requesting but still am getting the same http header response with * in the Access-Control-Allow-Origin.
Please guide me on this.
I'm sorry. I thought this example would be applicable to CORS headers in general but it was limited to "preflight" requests. It was explained in the Background section of the Context help as below:
Example: Modify CORS ResponseBackgroundCross domain requests for resources in another domain triggers preflighted requests that first send an HTTP request with OPTIONS as the HTTP Method. This is done to determine whether the actual request is safe. For more information about CORS, see here
I looked for any possibilities to rewrite the CORS headers but I couldn't find anything unfortunately.I'd like to suggest opening a support case with your detailed requirements.