vscode-live-server
vscode-live-server copied to clipboard
Status Code: 405 Method Not Allowed
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request
[ ] Other: <!-- Please describe: -->
Current behavior
This is a duplicate of Issues #54 and #66, but they have been closed. I have tried the suggestions in Issue #54, but they did not work for me (i.e. running on a different port and killing any task running on port 5500).
I have a simple HTML form with method="post". When the form is submitted, Live Server returns a 405 Method Not Allowed. Looking in the browser Developer Tools, the Response header has "Allow: GET, HEAD, OPTIONS".
Expected behavior
I would expect Live Server to not serve back a 405 error :)
Environment
Windows 7 Home, 64-bit
Browser:
- [x] Chrome (desktop) version 76.0.3809.100 (64-bit)
- [x] Firefox version 68.0.1 (64-bit)
- [ ] Safari (desktop) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Live Server: 5.6.1
- Platform: Windows
- Visual Studio Code: 1.36.1
mark this issue
we are having the same issue, we need help to solve this.
Same issue here too.
Same here
I managed to figure out what it was on my end. I was trying to get a package running (in particular, JQuery File Manager) and the package was trying to use Node.JS server calls to get the files on my server. Since it was only running through Live Server and not an actual Node server, it freaked out and this error was brought up. My fix was to actually transform my project into a real Node server.
I managed to figure out what it was on my end. I was trying to get a package running (in particular, JQuery File Manager) and the package was trying to use Node.JS server calls to get the files on my server. Since it was only running through Live Server and not an actual Node server, it freaked out and this error was brought up. My fix was to actually transform my project into a real Node server.
yow correct me if I am wrong, so you stop using the vs code live server?
I managed to figure out what it was on my end. I was trying to get a package running (in particular, JQuery File Manager) and the package was trying to use Node.JS server calls to get the files on my server. Since it was only running through Live Server and not an actual Node server, it freaked out and this error was brought up. My fix was to actually transform my project into a real Node server.
yow correct me if I am wrong, so you stop using the vs code live server?
Yea, I stopped using LiveServer in favor of using Node.
Same issue.
Request URL: http://127.0.0.1:5500/
Request Method: POST
Status Code: 405 Method Not Allowed
Remote Address: 127.0.0.1:5500
I think my issue is/was the same too. described here https://stackoverflow.com/questions/59024415/405-method-not-allowed-error-returned-upon-post-request-in-node-js-and-express/59027595#59027595
I found the same issue:
$.ajax('data/addToCart.json', { type: 'POST', dataType: 'json', contentType: 'application/json' })
Once I switch from Live Server to NodeJS's node-http-server the issue was no longer happening.
Same issue. Just stopped using Live Server in VS Code.
I just had the same issue. https://stackoverflow.com/questions/60010357/405-method-not-allowed-in-simple-html-form-php-code
I just had the same issue. https://stackoverflow.com/questions/60010357/405-method-not-allowed-in-simple-html-form-php-code
Dropping live server extension seems to solve it for most.
This is still an issue...
This is still an issue:
Here is my code:
const params = {
id: 123,
pepe: cuadrado
,
torre: 123456789
}
fetch(url
, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(params)
});
and html:
hola, running fetch
Visual Studio Code 1.54.3 from March 15 2021
This is still opened, maybe someone has an answer?
I just have the same issue
Me as well.
Same issue. PHP Server by brapifra is working fine tho.
OS: Arch Linux
Live Server: v5.7.4
VS Code: 1.63.2
This issue is still on
Same issue
Same issue. Wow, this is old.
I had the same problem, you can solve this problem by running a test server in the source folder of the website.
By simple running php -S localhost:8000
, PHP will create a test server, and you'll be able to run yours tests
same issue
When posting form data, code Live server reports it only accepts: GET, HEAD, OPTIONS not POST
When posting form data, Visual code Live server reports it only accepts: GET, HEAD, OPTIONS not POST Works fine in PHP server
POST scheme http host localhost:5500 filename /response.php/ Address 127.0.0.1:5500 Status 405 Method Not Allowed VersionHTTP/1.1 Transferred1.40 kB (0 B size) Referrer Policystrict-origin-when-cross-origin Request Priority Highest DNS Resolution System
Response Headers (271b) HTTP/1.1 405 Method Not Allowed Access-Control-Allow-Origin: http://localhost:5500 Vary: Origin Access-Control-Allow-Credentials: true Allow: GET, HEAD, OPTIONS Content-Length: 0 Date: Sun, 20 Aug 2023 16:00:08 GMT Connection: keep-alive Keep-Alive: timeout=5
Request Headers (1060b) POST /response.php/ HTTP/1.1 Host: localhost:5500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,/;q=0.8 Accept-Language: en-GB,en;q=0.5 Accept-Encoding: gzip, deflate, br Content-Type: application/x-www-form-urlencoded Content-Length: 68 Origin: http://localhost:5500 Connection: keep-alive Referer: http://localhost:5500/myform.html Upgrade-Insecure-Requests: 1 Sec-Fetch-Dest: document Sec-Fetch-Mode: navigate Sec-Fetch-Site: same-origin Sec-Fetch-User: ?1
This issue still exists for me. However i overcome it by disabling live server and installed html-live server extension in VS code. Restart your vs code and then click on the html file and then click "start web preview server " . Make sure your backend server also listen to the same port and IP to which your frontend is hosted
Issue still ongoing. Which is weird because the extension features list: "support for proxy" and "cors enabled". Only solution seems to be uninstalling Live Server