I am struggling for days to enable PUT and DELETE request for my PHP app at MS Azure. Some answers I found suggest to remove the WebDAV module from IIS.
How would I do so?
In Control Panel, click Programs and Features, and then click Turn Windows features on or off. Expand Internet Information Services, expand World Wide Web Services, expand Common HTTP Features, and then select WebDAV Publishing. Click OK. Click Close.
In IIS Manager, in the Connections pane, expand the Sites node in the tree, then click the Default Web Site. As shown in the image below, double-click the WebDAV Authoring Rules feature. When the WebDAV Authoring Rules page is displayed, click the Enable WebDAV task in the Actions page.
You should consider whether you need WebDAV functionality in your Content Management environment. If you do not need it, it is best practice to disable it on the CM, to reduce the surface area of your Sitecore environments. To disable WebDAV: In the <website>/App_Config/Sitecore/CMS.
PUT and DELETE requests should now work.
I've spent a whole day on this and tried every solution I ran into yet nothing worked for me. What finally worked was turning off the "WebDAV Publishing" feature from Turn Windows features on or off. This is located under:
Internet Information Services\World Wide Web Services\Common HTTP Features\WebDAV Publishing.
I am hosting a PHP application in Azure App Services and I was able to solve this problem by manually creating a file called web.config and adding it to the root directory of my web application.
Here is the entire content of that file.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<security>
<requestFiltering>
<verbs allowUnlisted="false">
<add verb="GET" allowed="true" />
<add verb="POST" allowed="true" />
<add verb="DELETE" allowed="true" />
<add verb="PUT" allowed="true" />
</verbs>
</requestFiltering>
</security>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="PHP56_via_FastCGI" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS,XYZ" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS,XYZ" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS,XYZ" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="PHP56_via_FastCGI" path="*.php" verb="GET, PUT, POST, HEAD, OPTIONS, TRACE, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK" modules="FastCgiModule" scriptProcessor="D:\Program Files (x86)\PHP\v5.6\php-cgi.exe" resourceType="Either" requireAccess="Script" />
</handlers>
</system.webServer>
</configuration>
You'll notice in the handlers section it references PHP56_via_FastCGI. This is specific to PHP 5.6. If you are using a different version of PHP you will need to update the name and file path to reflect that version.
sometimes I just can't believe that the same people who worked on the great .Net Core have worked on IIS and all this madness to say the least. I kept searching and trying to figure out what was the issue, furthermore I tried the best I can to log the error 405 Method not allowed
but to no avail. I didn't want to alter the web.config
file and didn't want to remove this pointless WebDavModule
thingy because my site is hosted along other sites other people working on so I didn't want to ruin the day for anyone else.
Now, this emotional introduction aside, I managed to make it work via simple IIS Configuration
steps. Imagine a figurative sarcastically double-quotes mark surrounding the word simple.
So here is what you can do:
PUT, DELETE
verbs for.Handler Mappings
click on WebDav
and then click Edit
Request Restrictions
and from there navigate to Verbs
tabAll verbs
and finally click OK. I swear this UI is more confusing than a whole map for the human brain neurons connections.
Web Site
because I did that just-in-case because I had enough headache for the following few months.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With