I have a REST api that is invoked by a Javascript Web application. HTML/CSS and JS files are stored locally and served by Apache, and the REST api is invoked with a ProxyPass directive by Apache on a remote HTTP server. This is my actual httpd.conf file (development machine is on windows):
<VirtualHost *:80>
ServerName myapp.com
DocumentRoot C:\myapp
<Directory />
Allow from all
</Directory>
RewriteLog C:\Temp\rewrite.log
RewriteLogLevel 0
RewriteEngine On
# Let apache serve static files
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f
RewriteRule (.*) $1 [L]
ProxyPass / http://192.168.0.23:4567/ retry=0
ProxyPassReverse / http://192.168.0.23:4567/
ProxyPreserveHost on
</VirtualHost>
My problem is that the remote server (192.168.0.23) does not support DELETE and PUT requests (I get a Method not allowed error if I try to do that). Unfortunately i don't have access to that server, but I can develop the REST api exposed by it. What I would like to do is
- check if the incoming request is DELETE or PUT
- set an HTTP header on the request X-ORIGINAL-REQUEST_METHOD: DELETE
- forward the request to the remote server (192.168.0.23) as POST
can this somehow be done with Apache rewrite rules or some other module?
0 Answers