question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HttpFileService could provide more options related to trailing slash

See original GitHub issue

I was trying to clean up code using the new file service capabilities (removing hacky path mapping to redirect everything to index.html for example) but found I can’t remove all my hacks since we use “clean URLs” without a trailing slash to read index.html for that page. The current HttpFileService will read index.html for requests that end with / but not otherwise. Adding an option to HttpFileServiceBuilder that allows URLs without an extension to have slash added before resolving the file would make this simpler.

For reference, firebase’s related setting https://firebase.google.com/docs/hosting/full-config#control_trailing_slashes

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
anuraagacommented, May 27, 2019

Thanks for checking the behavior! It sounds like they follow armeria’s current behavior then. I guess I’ll add a flag, and it’s basically similar to doing this sort of config in nginx when needing slash-less URLs - https://stackoverflow.com/a/31189870

0reactions
trustincommented, May 27, 2019

nginx and Apache HTTPd at least seem to send a redirect response when a client sent a request to a directory without a trailing slash (empty-to-slash), which matches the current HttpServerHandler behavior. I guess this kind of redirection is common for directories.

However, they indeed don’t send a redirect when showing an index file. That being said, I guess we can:

  • keep the current HttpServerHandler behavior as-is
  • make HttpFileService redirect for empty-to-slash cases while serving an index file without redirection

Additionally, we might want to add some configuration property to Server, like TrailingSlashPolicy if we need more flexibility?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nextjs should have more options for trailing slash. #23988
js will redirect urls with trailing slashes to their counterpart without a trailing slash. Can I disable it? Or can it be used...
Read more >
Trailing slash in Flask route - python - Stack Overflow
But I'm wondering if there's a better solution, like a drop-in app configuration of some sort, similar to strict_slashes=False that I can apply ......
Read more >
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 >
To slash or not to slash | Google Search Central Blog
Historically, it's common for URLs with a trailing slash to indicate a directory, and those without a trailing slash to denote a file:....
Read more >
What is a trailing slash? - Ryte Wiki
A trailing slash is the forward slash placed at the end of a URL. ... This multiple indexing can negatively effect the website...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found