Relative Content

Tag Archive for restdelphicorsdatasnap

Delphi Datasnap Server – How to correctly answer the OPTIONS method? CORS problem

Delphi 12 / Datasnap Server

I was created ‘Datasnap Server’ by wizard. This ma REST server. Angular application send me requests (GET or POST) but CORS makes communication difficult.
I modified header by adds some Allow-*, but is still problem with OPTIONS http method.

curl -i -X OPTIONS my_url

Response from server:

HTTP/1.1 500 Internal Server Error

Result is exception class TDSServiceException with message : ‘Command closed or unassigned’
In unit Datasnap.DSHTTP is function: DoRESTCommand and he skip command type OPTIONS.