tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier (tomcat) ...@ice-sa.com>
Subject Re: How to stop trailing slash redirects?
Date Fri, 07 Jun 2019 07:12:49 GMT
On 07.06.2019 08:31, Rob Nikander wrote:
>
>
>> On Jun 6, 2019, at 5:19 PM, André Warnier (tomcat) <aw@ice-sa.com> wrote:
>>
>> On 06.06.2019 13:28, Konstantin Kolinko wrote:
>>> чт, 6 июн. 2019 г. в 10:32, Rob Nikander <rob.nikander@gmail.com>:
>>>>
>>>> […]
>>>
>>> 1. Exact version number of Tomcat =? Does it support that attribute?
>
> Version 9.0.20.
>
> Thank you both for the recommendations and warnings. At the moment I’m not sure what
I’ll do.
>
> I often don’t think of URL paths like directories, but if I do that, then it makes
some sense to redirect. But in my case, the url “/myapp” is the entry point to my web
app, and it currently returns an intro page, not something that looks like a directory listing.
Once you get into the app it has other URLs like /myapp/login, /myapp/browse, /myapp/practice,
etc. I don’t have a great reason for disliking the slash; it’s mainly subjective preference
of thinking the URLs without slash look simpler and cleaner.
>
> Maybe my best “reason” to do this is that the minimal base URL /myapp is the obvious
entry point to the app, and my first choice to give out to the public as the app’s location,
so I want it to work as fast as possible, without a redirect.
>

What I was trying to say, is that the redirect is needed so that *the browser* would have

the correct URL for the page it is ultimately obtaining, so that *the browser* can 
correctly interpret any relative URLs which may exist in that page (and cookie paths etc..).
If your application is living totally in a closed world, where you are sure that it never

sends any page to a standard browser, containing such potentially confusing relative URLs

(and that it never will), there is nothing fundamentally which stops you from doing things

the way you describe above. (You could even rewrite the URL internally, and never tell the

browser about it). The same applies if the client side, in your case, would always be some

application which does not react like a standard browser.
But "never" is a very absolute word, and "never will" is quite a gamble, so we're just 
trying to recommend what in our opinion, is most likely to save you trouble in the future.
And we have such opinions, becase we've all "been there, done that" before, and have 
suffered the consequences.

The flip side of that, is that if you follow the advice and don't do that, then you'll 
never suffer these consequences, and we'll never be able to tell you "see, we told you 
so". Darn..



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message