0

I have an Azure cloud app running IIS8.0.
I have a Wordpress site running on it and I want to make a POST request to a certain resource.
When I use a REST console it succeeds with 200 code.
When I use a iOS app it returns an 405 error with the message "Method POST is not allowed".

I checked the request headers and they are exactly the same.

I googled and I found out it may have something to do with the handlers in IIS, therefor here are my handlers:

<handlers accessPolicy="Read, Script">
    <add name="PHP54_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.4\php-cgi.exe" resourceType="Either" />
    <add name="PHP53_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.3\php-cgi.exe" resourceType="Either" />
    <add name="CGI-exe" path="*.exe" verb="*" modules="CgiModule" resourceType="File" requireAccess="Execute" allowPathInfo="true" />
    <add name="TRACEVerbHandler" path="*" verb="TRACE" modules="ProtocolSupportModule" requireAccess="None" />
    <add name="OPTIONSVerbHandler" path="*" verb="OPTIONS" modules="ProtocolSupportModule" requireAccess="None" />
    <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
</handlers> 

Can anybody help me with my issue?

HansElsen
  • 1,209
  • 4
  • 19
  • 42

2 Answers2

1

I found out what was causing the issue. I was wondering why sending a request from my browser was valid and from the iOS app was not.

Both the browser and the app were sending exactly the same headers and payload and url.

The url was something like this: http://www.example.com/?json=subscribe/subscribe.

Turns out the app wasn't able to use this URL. I had to use: http://www.example.com/index.php?json=subscribe/subscribe

The index.php had to be added for iOS to work.

I'm adding Wordpress to the keywords.

HansElsen
  • 1,209
  • 4
  • 19
  • 42
0

You could try using a network packet listener like Wireshark to see the raw HTTP that iOS is sending.

Adrian
  • 211
  • 1
  • 5