why php PUT route works in apache but not in IIS?
I have a php+laravel API application hosted in azure app service.I have the same app hosted in apache in azure as well. The rest end points works properly in apache but in IIS hosted environment all the PUT verbs are failing with 405 (Method Not Allowed) error. I did not try DELETE yet but based on what I am seeing all preflight redirect verbs should be failing.
I spend a week on this, let me first explain what I did so far; I have added following to my web.config
<httpProtocol>
<customHeaders>
<add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains"/>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="X-Requested-With,Content-Type" />
<add name="Access-Control-Allow-Methods" value="POST,GET,OPTIONS,DELETE,PUT,PATCH" />
</customHeaders>
</httpProtocol>
With the access-control-allow-methods, I could by pass OPT calls from my front end application.
I tried few of the suggestion mentioned in Laravel 5.1 API Enable Cors answers. Also followed http://codecipher.in/laravel-cors/ so that I could avoid OPT calls from my client side. These changes did allow me to skip OPT calls and able to make my PUT. Unfortunately the PUT calls though it is still failing.
I called the PUT endpoint through postman and I get "The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used." error. In the headers I can see
access-control-allow-methods →POST,GET,OPTIONS,DELETE,PUT,PATCH
but I did see allow as
allow →GET, HEAD, OPTIONS, TRACE
Like I mentioned, the application hosted in Apache works just fine and I would like to give it a try in IIS before I give up and move completely to Apache.
What does IIS uses to prevent calls to PUT verb not to execute?
Thanks
laravel azure iis
add a comment |
I have a php+laravel API application hosted in azure app service.I have the same app hosted in apache in azure as well. The rest end points works properly in apache but in IIS hosted environment all the PUT verbs are failing with 405 (Method Not Allowed) error. I did not try DELETE yet but based on what I am seeing all preflight redirect verbs should be failing.
I spend a week on this, let me first explain what I did so far; I have added following to my web.config
<httpProtocol>
<customHeaders>
<add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains"/>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="X-Requested-With,Content-Type" />
<add name="Access-Control-Allow-Methods" value="POST,GET,OPTIONS,DELETE,PUT,PATCH" />
</customHeaders>
</httpProtocol>
With the access-control-allow-methods, I could by pass OPT calls from my front end application.
I tried few of the suggestion mentioned in Laravel 5.1 API Enable Cors answers. Also followed http://codecipher.in/laravel-cors/ so that I could avoid OPT calls from my client side. These changes did allow me to skip OPT calls and able to make my PUT. Unfortunately the PUT calls though it is still failing.
I called the PUT endpoint through postman and I get "The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used." error. In the headers I can see
access-control-allow-methods →POST,GET,OPTIONS,DELETE,PUT,PATCH
but I did see allow as
allow →GET, HEAD, OPTIONS, TRACE
Like I mentioned, the application hosted in Apache works just fine and I would like to give it a try in IIS before I give up and move completely to Apache.
What does IIS uses to prevent calls to PUT verb not to execute?
Thanks
laravel azure iis
This shouldn't be limited to Laravel or PHP, but with your IIS configuration, as PUT is an HTTP specification.
– fyrye
Nov 21 '18 at 17:32
add a comment |
I have a php+laravel API application hosted in azure app service.I have the same app hosted in apache in azure as well. The rest end points works properly in apache but in IIS hosted environment all the PUT verbs are failing with 405 (Method Not Allowed) error. I did not try DELETE yet but based on what I am seeing all preflight redirect verbs should be failing.
I spend a week on this, let me first explain what I did so far; I have added following to my web.config
<httpProtocol>
<customHeaders>
<add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains"/>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="X-Requested-With,Content-Type" />
<add name="Access-Control-Allow-Methods" value="POST,GET,OPTIONS,DELETE,PUT,PATCH" />
</customHeaders>
</httpProtocol>
With the access-control-allow-methods, I could by pass OPT calls from my front end application.
I tried few of the suggestion mentioned in Laravel 5.1 API Enable Cors answers. Also followed http://codecipher.in/laravel-cors/ so that I could avoid OPT calls from my client side. These changes did allow me to skip OPT calls and able to make my PUT. Unfortunately the PUT calls though it is still failing.
I called the PUT endpoint through postman and I get "The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used." error. In the headers I can see
access-control-allow-methods →POST,GET,OPTIONS,DELETE,PUT,PATCH
but I did see allow as
allow →GET, HEAD, OPTIONS, TRACE
Like I mentioned, the application hosted in Apache works just fine and I would like to give it a try in IIS before I give up and move completely to Apache.
What does IIS uses to prevent calls to PUT verb not to execute?
Thanks
laravel azure iis
I have a php+laravel API application hosted in azure app service.I have the same app hosted in apache in azure as well. The rest end points works properly in apache but in IIS hosted environment all the PUT verbs are failing with 405 (Method Not Allowed) error. I did not try DELETE yet but based on what I am seeing all preflight redirect verbs should be failing.
I spend a week on this, let me first explain what I did so far; I have added following to my web.config
<httpProtocol>
<customHeaders>
<add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains"/>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="X-Requested-With,Content-Type" />
<add name="Access-Control-Allow-Methods" value="POST,GET,OPTIONS,DELETE,PUT,PATCH" />
</customHeaders>
</httpProtocol>
With the access-control-allow-methods, I could by pass OPT calls from my front end application.
I tried few of the suggestion mentioned in Laravel 5.1 API Enable Cors answers. Also followed http://codecipher.in/laravel-cors/ so that I could avoid OPT calls from my client side. These changes did allow me to skip OPT calls and able to make my PUT. Unfortunately the PUT calls though it is still failing.
I called the PUT endpoint through postman and I get "The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used." error. In the headers I can see
access-control-allow-methods →POST,GET,OPTIONS,DELETE,PUT,PATCH
but I did see allow as
allow →GET, HEAD, OPTIONS, TRACE
Like I mentioned, the application hosted in Apache works just fine and I would like to give it a try in IIS before I give up and move completely to Apache.
What does IIS uses to prevent calls to PUT verb not to execute?
Thanks
laravel azure iis
laravel azure iis
edited Nov 21 '18 at 17:33
fyrye
9,04413649
9,04413649
asked Nov 21 '18 at 17:16
unniunni
84
84
This shouldn't be limited to Laravel or PHP, but with your IIS configuration, as PUT is an HTTP specification.
– fyrye
Nov 21 '18 at 17:32
add a comment |
This shouldn't be limited to Laravel or PHP, but with your IIS configuration, as PUT is an HTTP specification.
– fyrye
Nov 21 '18 at 17:32
This shouldn't be limited to Laravel or PHP, but with your IIS configuration, as PUT is an HTTP specification.
– fyrye
Nov 21 '18 at 17:32
This shouldn't be limited to Laravel or PHP, but with your IIS configuration, as PUT is an HTTP specification.
– fyrye
Nov 21 '18 at 17:32
add a comment |
2 Answers
2
active
oldest
votes
It depends on the server configurations. Some simply decide they do not want to enable such requests for whatever reason they will give you once you ask them. Thing is, not all servers will allow you to have those accessible.
I think a previous post created can help you sort your IIS environment.
If you have no control over the production server or very limited control over its configuration I would advice dropping those and keep the default Requests;
add a comment |
For those facing the same problem, the answer is to add the following section in the web.config file in site/public folder. Do a cache clean and restart the server.
<system.webServer>
<handlers>
<remove name="PHP72_via_FastCGI" />
<add name="PHP72_via_FastCGI" path="*.php" verb="GET, POST, PUT, DELETE, PATCH" modules="FastCgiModule" scriptProcessor="D:Program Files (x86)PHPv7.2php-cgi.exe" resourceType="Either" requireAccess="Script" />
</handlers>
</system.webServer>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53417421%2fwhy-php-put-route-works-in-apache-but-not-in-iis%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
It depends on the server configurations. Some simply decide they do not want to enable such requests for whatever reason they will give you once you ask them. Thing is, not all servers will allow you to have those accessible.
I think a previous post created can help you sort your IIS environment.
If you have no control over the production server or very limited control over its configuration I would advice dropping those and keep the default Requests;
add a comment |
It depends on the server configurations. Some simply decide they do not want to enable such requests for whatever reason they will give you once you ask them. Thing is, not all servers will allow you to have those accessible.
I think a previous post created can help you sort your IIS environment.
If you have no control over the production server or very limited control over its configuration I would advice dropping those and keep the default Requests;
add a comment |
It depends on the server configurations. Some simply decide they do not want to enable such requests for whatever reason they will give you once you ask them. Thing is, not all servers will allow you to have those accessible.
I think a previous post created can help you sort your IIS environment.
If you have no control over the production server or very limited control over its configuration I would advice dropping those and keep the default Requests;
It depends on the server configurations. Some simply decide they do not want to enable such requests for whatever reason they will give you once you ask them. Thing is, not all servers will allow you to have those accessible.
I think a previous post created can help you sort your IIS environment.
If you have no control over the production server or very limited control over its configuration I would advice dropping those and keep the default Requests;
answered Nov 21 '18 at 17:20
Diogo SantoDiogo Santo
48818
48818
add a comment |
add a comment |
For those facing the same problem, the answer is to add the following section in the web.config file in site/public folder. Do a cache clean and restart the server.
<system.webServer>
<handlers>
<remove name="PHP72_via_FastCGI" />
<add name="PHP72_via_FastCGI" path="*.php" verb="GET, POST, PUT, DELETE, PATCH" modules="FastCgiModule" scriptProcessor="D:Program Files (x86)PHPv7.2php-cgi.exe" resourceType="Either" requireAccess="Script" />
</handlers>
</system.webServer>
add a comment |
For those facing the same problem, the answer is to add the following section in the web.config file in site/public folder. Do a cache clean and restart the server.
<system.webServer>
<handlers>
<remove name="PHP72_via_FastCGI" />
<add name="PHP72_via_FastCGI" path="*.php" verb="GET, POST, PUT, DELETE, PATCH" modules="FastCgiModule" scriptProcessor="D:Program Files (x86)PHPv7.2php-cgi.exe" resourceType="Either" requireAccess="Script" />
</handlers>
</system.webServer>
add a comment |
For those facing the same problem, the answer is to add the following section in the web.config file in site/public folder. Do a cache clean and restart the server.
<system.webServer>
<handlers>
<remove name="PHP72_via_FastCGI" />
<add name="PHP72_via_FastCGI" path="*.php" verb="GET, POST, PUT, DELETE, PATCH" modules="FastCgiModule" scriptProcessor="D:Program Files (x86)PHPv7.2php-cgi.exe" resourceType="Either" requireAccess="Script" />
</handlers>
</system.webServer>
For those facing the same problem, the answer is to add the following section in the web.config file in site/public folder. Do a cache clean and restart the server.
<system.webServer>
<handlers>
<remove name="PHP72_via_FastCGI" />
<add name="PHP72_via_FastCGI" path="*.php" verb="GET, POST, PUT, DELETE, PATCH" modules="FastCgiModule" scriptProcessor="D:Program Files (x86)PHPv7.2php-cgi.exe" resourceType="Either" requireAccess="Script" />
</handlers>
</system.webServer>
answered Nov 22 '18 at 7:00
unniunni
84
84
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53417421%2fwhy-php-put-route-works-in-apache-but-not-in-iis%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This shouldn't be limited to Laravel or PHP, but with your IIS configuration, as PUT is an HTTP specification.
– fyrye
Nov 21 '18 at 17:32