Closed pulcheri closed 6 years ago
I think you want to do something more like this (using hookAny
):
corsHeader =
do ctx <- getContext
setHeader "Access-Control-Allow-Origin" "*"
setHeader "Access-Control-Allow-Headers" "Content-Type"
pure ctx
myApp =
do hookAny OPTIONS (\path -> corsHeader)
get ("my" <//> "cool" <//> "path") $ ...
That's what I used in a recent app.
First, thanks for the great framework - I really enjoy using Spock! Although, as have been mentioned elsewhere lack of documentation of advanced features is frustrating. For instance, I'd like to be able to set "Access-Control-Allow-Origin: *" response header - how is that possible?