Add option to remove trailing slashes, as opposed to adding them
See original GitHub issueHello!
We’re serving a website through Gatsby, which is having some trouble removing trailing slashes when serving an index.html
file.
As you can see from the PR and discussion, it seems to be impossible through configuration options to remove the trailing slash, even if it’s possible to stop from redirecting to a trailing slash.
Would you be interested in a PR which adds (or changes) an option to remove trailing slashes when serving index files?
Thank you very much 😃
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Should You Have a Trailing Slash at the End of URLs? - Ahrefs
A trailing slash is a forward slash (“/”) placed at the end of a URL such as domain.com/ or domain.com/page/. But should you...
Read more >How to edit trailing slashes in WordPress permalinks?
Permalink Manager may be a useful solution to modify trailing slashes settings if you do not have any technical skills or simply do...
Read more >What is the simplest way to remove a trailing slash from each ...
The accepted answer will trim ONE trailing slash. One way to trim multiple trailing slashes is like this:
Read more >Trailing Slash: What Is It In a URL? And Should You Have It
Go to Settings > Permalinks. Click on “Post Name” to automatically add trailing slashes to URLs and set up a proper 301 redirect....
Read more >trailingslashit() | Function - WordPress Developer Resources
Will remove trailing forward and backslashes if it exists already before adding a trailing forward slash. This prevents double slashing a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You’d be surprised 😃 I am constantly helping new web programmers with little to no understanding of any of this, and would expect it to look the same way as when they double-click on the file on their file system.
I don’t think having the option you propose would be valid for this project now that I better understand it, I’m sorry. You’re welcome to use a different project or similar if that is really what you want to do without having a file system layout that matches the files served. But in reality, files should never be served up by Node.js unless as a last resort, so you should be using Apache/NGINX/etc. I’m not sure if they have those options you’re looking for, either, but if they do, that would probably be the best overall solution.
Hi @formulahunter this is a general Node.js question I would suggest asking on Node.js itself to get the full answer. The short answer is that serving files will consume your worker pool (https://nodejs.org/en/docs/guides/dont-block-the-event-loop/).