WebDev CORS error in V8.1.5

I tried to develop a webdev api. And When I create a post method, when I request from client, I entered a cors error. Then I tried to add a cors header like this:

servletResp = request[‘servletResponse’]
servletResp.addHeader(‘Access-Control-Allow-Origin’, ‘*’ )
servletResp.setHeader(“Access-Control-Allow-Methods”, “POST, GET, PUT, OPTIONS, DELETE”)

It works in v7.9 and v8.0, but now I use v8.1.5 and it seems dosen’t work.
Need help!

Are you only implementing doPost? To properly support CORS, you should be implementing doOptions to return your rewritten CORS headers.

1 Like