Limit access to *.jsf files

Splash Forums PrettyFaces Users Limit access to *.jsf files

This topic contains 3 replies, has 4 voices, and was last updated by  RedShadow 6 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #17946

    babltiga
    Participant

    I’m new to JSF and pretty faces so my question can be simple. So in my project I have following mapping @URLMapping(id = “index”, pattern = “/index”, viewId = “/index.jsf”) it work great but now I what to prohibit access to index.jsf directly.

    So now http://www.mysite.com/index and http://www.mysite.com/index.jsf both work but I want to disable second one.

    Thanks ..

    #20993

    Hey,

    I have some people looking into the best answer for you here. Will hopefully have something soon. It’s a good question and of course you can always just create your own Filter that denies access to these URLs (which is what I usually do,) but I think there’s a more elegant solution.

    ~Lincoln

    #20994

    I don’t think this is possible without writing a custom filter. One thing you could try is to create a rewrite rule to redirect the user to /index if /index.jsf is accessed. Something like:

    <rewrite match="/(.*).jsf" substitute="/$1" redirect="301"/>

    I didn’t test this, but you could try it. :)

    #20995

    RedShadow
    Participant

    I already had such a problem and i did it like that:

    <rewrite match=”^/admin/((?!pageNotFound).)*.xhtml$” substitute=”/admin/pageNotFound.xhtml”/>

    this will restrict access to all xhtml files except the pageNotFound.xhtml. if a request goes to a xhtml file, the request will be redirected to the pageNotFound.xhtml

    Chaining does not work, but i still don’t know why.

    This is tested for my case and should work.

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

You must be logged in to reply to this topic.

Comments are closed.