AnsweredAssumed Answered

ArcGIS Server REST API - POST OPTIONS preflight request: 405 Method not allowed

Question asked by mattia.franscella on Feb 13, 2017

Hello,

 

I am building a GIS web app but I have a problem with the Firefox browser.

I'm developing in JS a GIS web app that allows the user to edit a feature layer (note: I don't use the ArcGIS API for JS).


The HTTP POST request to create a new record in the ArcGIS Server is the following:
http://server/arcgis/rest/services/layerName/FeatureServer/0/addFeatures

 

As the documentation says (http://resources.arcgis.com/en/help/rest/apiref/fsadd.html), the operations that can
permanently change the state of your system (add, update, delete) are POST-only operations. Otherwise, an appropriate error message with an error code of 405 (Method not allowed) will be sent to the client.

 

In Chrome and IE, to run this POST request and to avoid CORS problem, I use a proxy.

Firefox instead, in order to determine whether the actual request is safe to send, first "preflight" the POST requests sending an HTTP request by the OPTIONS method to the resource on the other domain (https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS).

 

Considering therefore that the ArcGIS Server accepts only POST requests to add features and considering that Firefox first send an OPTIONS method, I have a problem to edit a feature layer using Firefox.
In fact, the following request:
http://server/arcgis/rest/services/layerName/FeatureServer/0/addFeatures

return an error code of 405 (Method not allowed).

 

Is there a work-around or a method to fix this problem? Especially considering that maybe one day, other browsers could implement this OPTIONS request for security reasons.

 

Thank you very much.

M.F.

Outcomes