URL Landing on a folder
June 25, 2012 at 3:55 pm #18465
Let’s say we have this folder layout :
And in rewrite configuration :
It looks like something (may be JSF?) unallow me to land on a folder without a trailing slash.
Is there a way for me to access my ressource with http://localhost:8080/ctx/folder ?June 26, 2012 at 1:16 am #22682
Lincoln Baxter IIIKeymaster
A little more information might help figure this out
What server are you using? Do you have any other URL-rewriting configured? Can you reproduce this in other applications on this server? Could you attach an app that reproduces this?
I doubt JSF would be involved since Rewrite should be intercepting things first, so this is probably a configuration in the container, or in another filter.
~LincolnJune 26, 2012 at 4:58 am #22683
I saw similar behavior once on an application running on AS7. It was a very simply JSF app with PrettyFaces 3.3.3 and a URL mapping for
/something. I never figured out what was wrong and who was sending the redirect. I doubt that it was PrettyFaces’ fault. I “fixed” it back then by appending a
/to my mapping pattern which solved the problem.June 26, 2012 at 4:58 am #22684
I can reproduce it with this really simple app http://robotrock.fr/RewriteTest.tar.bz2
I’m using glassfish 3.1.2 b23June 27, 2012 at 1:19 pm #22685
Interesting. I just tested your app on AS7. I got nearly the same behavior. The only difference is that I’m getting a 302 instead of a 301.June 27, 2012 at 1:23 pm #22686
Ah, I found something. It seems to depend on whether the requested virtual path exists on in the web resources.
I did this:
http://localhost:8080/RewriteTest/simpletest ----> 404
But if I add an empty directory called
simletestto the root directory of my web app the same requests results in:
http://localhost:8080/RewriteTest/simpletest ----> 302 to: http://localhost:8080/RewriteTest/simpletest/
Strange, isn’t it. Seems to be a container specific thing.June 27, 2012 at 1:28 pm #22687
Same behavior in Tomcat 7.0.22. Seems like others are running into this problem as well:June 27, 2012 at 1:36 pm #22688
I did some research on this. The guys on tomcat-users wrote that this behavior has been implemented because it is “required by the HTTP spec”. I don’t fully understand why. But it seems like most of the containers implement something similar.
So I guess the only option for you would be to either append the trailing slash to your virtual URL (the
path()part of your join) or you simply rename the directory in your webapp to something else to prevent the name clash.
ChristianJune 27, 2012 at 10:40 pm #22689
Strange behavior indeed, may be some JEE spec’s requires this behavior I can’t see why it would be HTTP specific.
Thanks for the researches, I think I’ll put everything in a root directory like “faces” and create rules to use the URLs I really want!
You must be logged in to reply to this topic.