Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is 405 Method Not Allowed always returned? #170

Closed
binarykitchen opened this issue Mar 13, 2016 · 10 comments
Closed

Why is 405 Method Not Allowed always returned? #170

binarykitchen opened this issue Mar 13, 2016 · 10 comments
Assignees
Labels

Comments

@binarykitchen
Copy link
Contributor

This on POST requests.

> User-Agent: curl/7.43.0
> Accept: */*
> Content-Length: 167
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 167 out of 167 bytes
< HTTP/1.1 405 Method Not Allowed
< Allow: GET, HEAD, OPTIONS
< Content-Length: 0
< Date: Sun, 13 Mar 2016 02:46:59 GMT
< Connection: keep-alive

It is this code for reproduction:
https://github.com/binarykitchen/videomail-client/blob/master/Gulpfile.js#L104

@binarykitchen
Copy link
Contributor Author

Ah, I found the culprit. If uncomment the root option, then it works, no 405. Weird. Probably the connect.directory middleware is messing here with something else

@binarykitchen
Copy link
Contributor Author

Hmmm, serve-index causes this. See line https://github.com/expressjs/serve-index/blob/master/index.js#L102 ... uhhhh :(

@binarykitchen
Copy link
Contributor Author

a solution would be to rearrange the order. to run the custom middleware first before serve-index

@binarykitchen
Copy link
Contributor Author

@justinmchase ping

@binarykitchen
Copy link
Contributor Author

I think this commit broke it
1352e3d

Order of middleware is crucial. Please restore.

@justinmchase
Copy link
Collaborator

I'm swamped right now but took a look at it and didn't see any obvious reason why the order of the middleware would be changed. Can you send a PR, or at least help me narrow down where the issue is happening? If I generally knew a fix I could probably crank it out in hours, sorry for delay.

@justinmchase justinmchase self-assigned this Mar 16, 2016
@binarykitchen
Copy link
Contributor Author

@justinmchase here you go, it is very simple #171

@justinmchase
Copy link
Collaborator

Fixed in v3.1.1

@binarykitchen
Copy link
Contributor Author

great, the error is gone now, all works fine like before. thanks for quick reaction

@binarykitchen
Copy link
Contributor Author

ps: @justinmchase can you please look at #140?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants