[Progress Communities] [Progress OpenEdge ABL] Forum Post: CORS preflight with webspeed on 10.2b

Status
Not open for further replies.
A

AdrianJones

Guest
Hi All, i'm trying to develop a webspeed api in 10.2b that receives and returns json via a POST. this is to be called from some other web page (an angular app - eventually) and so chrome is using cors for the cross site verification. I'm struggling to get this to work and wondered if anyone has done this before and has any tips etc. for my normal data response i'm sending... output-http-header("Access-Control-Allow-Origin", "*"). output-http-header("Access-Control-Allow-Methods", "GET, POST, OPTIONS, HEAD"). output-content-type("application/json":U). /* populate dsResponse somehow */ DATASET dsResponse:WRITE-JSON("stream":U, "webstream":U). this seems to work OK. when the preflight is required i tried checking the request and short circuiting the response... IF request_method = "OPTIONS" THEN DO: output-http-header("Access-Control-Allow-Origin", "*"). output-http-header("Access-Control-Allow-Methods", "GET, POST, OPTIONS, HEAD"). return. END. This doesn't seem to be working. I;m getting bad gate-way error and No 'Access-Control-Allow-Origin' header is present on the requested resource. Am i barking up the wrong tree here? Is it possible to handle CORS in this manner. I've also googled and discovered possible IIS config option or using a cors proxy. Anyone any experience with these? AKJ

Continue reading...
 
Status
Not open for further replies.
Top