-
Notifications
You must be signed in to change notification settings - Fork 416
Trailing slash in URL for POST method causes error #654
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
Comments
Read the HTTP specs, the correct is: |
I don't think so. HTTP specs has nothing to do with it. It's more on how you would interpret a RESTful resource. Have a look Trailing slash only means "collection". POST http://api.blog.local/posts/ -> means create an element(s) to a collection I mentioned POST specifically because the rest of the verbs works as expected. |
I'm currently experiencing the same issue. The weird thing about this is that the trailing |
@michael-erwin REST has nothing to do with this as well. from a URI perspective a trailing slash to a collection is about as relevant as a path to a bonafied file. COULD be but not necessarily (nor is this defined). I feel a little tangental however your concern is valid. Just stumbled across this when researching the very same topic in another ecosystem.I know the specs like the back of my hand but Laravel not so much. Assuming Ockham's Razor in effect i'd assume any route to
This is news to me. Can you provide examples? I work with all the vendors on a daily basis implementing specs. Never heard of this. Is actually bug worthy in the respective browser if this is true as there is nothing within the specs that mandates this. I wouldn't count on this bug/feature to be future proof. I don't ever promise anything and I can promise you that one.
That's a vast assumption. The Facts are the spec, SEO, etc. encourage otherwise. However framework implementors keep perpetuating anti-patterns. It winds up in our laps as "just how we were taught". Just because the framework behaves this way doesn't mean it's correct. Over in WHATWG i'm dealing with the fact the world used To make a long story longer, as stated before |
After speaking with some spec members @humbertowoody the browser adds a Does this make sense? |
This works for me. Try updating to the latest version. |
It may be also something related to the web server, because in my case, it works both ways locally and the same script sends an error on production if called with a trailing slash. |
Is there i way i could fix this issue in the server, |
In web.php
In views/comments/create.blade.php
This works fine when serving locally with But fails in production with Apache or NGINX server My AdviceInstead of hard-coding the resources, You should use resource/route names. In that case, you never have to remember if your server will trim/append a trailing slash. In web.php
In views/comments/create.blade.php |
Description:
When sending POST request to URL with additional slash added at end the response results to "405 Method Not Allowed".
Steps To Reproduce:
Example:
Example:
The text was updated successfully, but these errors were encountered: