07-May-2020 06:45
i need to add a CORS header to this Irule. Can someone tell me where it would go?
The CORS header i need added is Access-Control-Allow-Origin: *
Here is our current Irule.
when HTTP_REQUEST {
set json "{ \"message\": {\"title\": \"System Maintenance\", \"body\": \"System is undergoing maintenance.\", \"summary\": \"Please try again later.\" }}"
HTTP::respond 418 content $json "Content-Type" "application/json"
TCP::close
}
12-May-2020
02:05
- last edited on
04-Jun-2023
21:27
by
JimmyPackets
At the end of the HTTP::respond it supports headers. Name then Value.
HTTP::respond 418 content $json "Content-Type" "application/json" "Name" "Value" "Name" "Value" ....
18-May-2020 12:38
Thank you. Sometimes seeing things written out in such a simple way immediately clears up the mistake. Mine was that I missed quotes on one of my values. Your example highlighted that to me immediately.