I'm using PHP cURL to upload a Shapefile to GeoServer. It works fine in a development server. But when I deploy to Stage server and I try the same I get:
405 Method Not Allowed
The requested method PUT is not allowed for the URL /geoserver/rest/workspaces/my_workspace/datastores/my_datastore/file.shp.
Apache/2.4.18 (Ubuntu) Server at my.stage-domain.com Port 80
I've tried Google about how to enable PUT requests, but nothing seems to work. I've installed both development and stage servers (both running Ubuntu 16.04) and I didn't had to enable PUT on my development server. It just worked.
Looking around here I've found this question and the answers suggests to register the webapp, but I don't even know how to do that...
Do you have any suggestions? I'm really stuck here...
As suggested in comments, I replaced the Linux binary version for the
geoserver.war file running over Tomcat 8. I've also reinstalled the server so now I have Ubuntu 17.04 and Apache 2.4.27 as in my development server. Unfortunately, the issue remains exactly the same. So I guess it's a web server issue.
access.log file on Apache2 logs shows:
aaa.bbb.ccc.ddd - - [08/Jan/2018:15:02:27 +0000] "PUT /geoserver/rest/workspaces/my_workspace/datastores/my_datastore/file.shp HTTP/1.1" 405 629 "1" "-"
Some answers and comments suggest to use
POST instead of
PUT method. I am uploading a zipped shapefile to an existing datastore. This:
Uploads files to the data store, creating it if necessary
In the API docs it says clearly that I must use