-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Handling directory routes that end both with and without a trailing slash #922
Comments
Hmm... I'm no Hapi expert, but I am not experiencing that problem. In my server options I have the following set:
And in my routes, I have:
I wonder if you're having the trailing slash issue because you've specified listing:true in your route? |
I'm assuming you are navigating manually to |
@hueniverse I first noticed this when sharing the link as I understand that it is not the responsibility of the hapi team to be concerned with user error of incorrect typing or Google's very odd link globbing procedure. I'm bringing this up with hopes of finding a workaround or a suggested method so I can close up a potential hole in user experience of my application. |
I am using a route like follows, in order to serve static content in the
public
directory:There is a subdirectory of
public
calledcartography
. Whenever I access the URLhttp://localhost/cartography/
, everything works fine. However, when I access the URLhttp://localhost/cartography
(without trailing slash) all of my relative URLs on the page become 404s because instead of looking forhttp://localhost/cartography/style.css
, it serveshttp://localhost/style.css
.I admit to being spoiled by web servers like Apache/nginx, and I understand hapi may not necessarily be a replacement for Apache. I just happen to like hapi a lot.
My question is, what is the preferred way to handle this situation with the trailing slash? Is there a way to redirect users from the non-slash to the slash? Do I just not use relative URLs?
Thanks.
The text was updated successfully, but these errors were encountered: