Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Add CORS header to current Irule.

F5_newbie
Nimbostratus
Nimbostratus

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

}

2 REPLIES 2

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" ....

F5_newbie
Nimbostratus
Nimbostratus

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.