在akka中将标头设置为HttpResponse

时间:2016-05-24 09:02:18

标签: scala akka akka-http

我正在尝试将标头设置为HttpResponse

var response = HttpResponse()
val acrh = request.headers.filter(q => q.name() == "Access-Control-Request-Headers").head.value()
response = response.addHeader(`Access-Control-Allow-Headers`(acrh))
response = response.addHeader(`Access-Control-Request-Headers`(acrh))

作为回应,我只能看到“Access-Control-Allow-Headers”,我收到此错误

"HTTP header 'Access-Control-Request-Headers' is not allowed in responses". 

我该如何解决这个问题?我需要为CORS实现这个。

0 个答案:

没有答案