URL Landing on a folder

Splash Forums Rewrite Users URL Landing on a folder

This topic contains 8 replies, has 3 voices, and was last updated by  detestable 9 years, 7 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #18465


    Let’s say we have this folder layout :



    And in rewrite configuration :



    When I hit http://localhost:8080/ctx/folder I get a 301 to http://localhost:8080/ctx/folder/

    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 ?



    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.



    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.



    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.


    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 simletest to 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.


    Same behavior in Tomcat 7.0.22. Seems like others are running into this problem as well:



    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.




    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!

Viewing 9 posts - 1 through 9 (of 9 total)

The forum ‘Rewrite Users’ is closed to new topics and replies.

Comments are closed.