How do I automatically add slash to end of a url i

2020-04-20 06:42发布

问题:

It's common practice for web servers to automatically redirect users to a URL ending in a slash when that URL represents a "directory". For example, entering http://www.apache.org/licenses into a browser redirects to http://www.apache.org/licenses/ automatically.

Due to the way spray's path-segment-based route matching works, I can't see an obvious way to create this behavior for a specific path segment. Any ideas?

标签: scala spray