3 ms·
> And a small issue on top of that: If you define /route, /route/ will still throw a 404. The right solution would be to serve the page on the two routes but se
by always_good 8y ago
> And a small issue on top of that: If you define /route, /route/ will still throw a 404. The right solution would be to serve the page on the two routes but set one as canonical source. But you have to do that manually.
In most cases you can get away with wholesale removing and redirecting all trailing slashes in middleware.
- astrodust 8y agoRack gets you out of a lot of jams if you know how to use it effectively.
- tcopeland 8y agoThat's the truth. I had a thing come up the other day where a client wasn't including a content type header and thus the body was being interpreted as application/x-www-form-urlencoded. Rack middleware to the rescue on that one.
- stevekemp 8y agoTo be honest I always just define: get '/foo/?' ... That will handle both, although I appreciate I should probably stick a redirect in place to make one the canonical link.