pretty faces 3.3.2 tomcat 7 configuration problem

Splash Forums PrettyFaces Users pretty faces 3.3.2 tomcat 7 configuration problem

Tagged: 

This topic contains 5 replies, has 4 voices, and was last updated by  Lincoln Baxter III 5 years, 7 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #18120

    adrian.wiktor
    Participant

    I would like to apply this configuration on my apache2

    <VirtualHost *:80>

    //stuff goes here

    <Proxy *>

    Order deny,allow

    Allow from all

    </Proxy>

    ProxyPass / http://localhost:8080/<context-of-my-app>/

    ProxyPassReverse / http://localhost:8080/<context-of-my-app>/

    //other configuration stuff

    when I apply this. and type mydomain.pl in web browser I see my index.jsf page.

    But when I click on any link, on this page I am geting this kind of url:

    mydomain.pl/<context-of-my-app>/myprettylink so I am ending up with this request

    (url: mydomain.pl/<context-of-my-app>/<context-of-my-app>/myprettylink) because there is no such link I am ending on my 404 page.

    Is there a way to disable this context part of an url which is appended by pretty link ?

    Regards Adrian Wiktor.

    #21859

    No, you cannot disable the context path because EVERY web application is required to have one. What I would suggest you is to change the context path of your web application to / (the root context). You can achieve this by renaming the WAR file your are deploying to the webapps directory to ROOT.war. Then simply change your proxy configuration to:

    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/

    I hope this helps

    Christian

    #21860

    adrian.wiktor
    Participant

    Ok, thx, for replay. :)

    #21861

    Petter Helset
    Participant

    The “solution” with ROOT.war -> ROOT is disappointing.

    If you have two applications running on the same tomcat:

    http://www.example.com:8080/app1/

    http://www.example.com:8080/app2/

    And you want to map these applications to different hosts with Apache mod_proxy:

    app1.example.com –> http://localhost:8080/app1/

    app2.example.com –> http://localhost:8080/app2/

    <VirtualHost *:80>

    ServerName app1.example.com

    DocumentRoot /var/www/

    ProxyRequests Off

    ProxyPreserveHost On

    ProxyPass / http://localhost:8080/app1/

    ProxyPassReverse / http://localhost:8080/app1/

    <Proxy *>

    Order deny,allow

    Allow from all

    </Proxy>

    <Location />

    Order deny,allow

    Allow from all

    </Location>

    </VirtualHost>

    <VirtualHost *:80>

    ServerName app2.example.com

    DocumentRoot /var/www/

    ProxyRequests Off

    ProxyPreserveHost On

    ProxyPass / http://localhost:8080/app2/

    ProxyPassReverse / http://localhost:8080/app2/

    <Proxy *>

    Order deny,allow

    Allow from all

    </Proxy>

    <Location />

    Order deny,allow

    Allow from all

    </Location>

    </VirtualHost>

    It won’t work, bco the context-path problem described by adrian.wiktor in post #1.

    The “solution” for this scenario is to deploy the two applications on separate tomcats at ROOT.

    Is there really no other way?

    #21862

    I’m not an expert for configuring mod_proxy, so I’m only guessing here. But it seems like the ProxyPassReverse configuration isn’t working like expected.

    I’ve one idea what’s going wrong here. PrettyFaces send redirects like this:

    Location: /app2/some-file

    And NOT something like this:

    Location: http://localhost:8080/app2/some-file

    So perhaps you could try this one:

    ProxyPass / http://localhost:8080/app2/
    ProxyPassReverse / /app2/

    Or, as PrettyFaces doesn’t touch the host part of the URL, this could also work:

    ProxyPass / http://localhost:8080/app2/
    ProxyPassReverse / http://app2.example.com/app2/

    If that doesn’t work, you should use Firebug or some other development tool to have a look at the Location header and modify the ProxyPassReverse option accordingly.

    See also:

    http://www.humboldt.co.uk/2009/02/the-mystery-of-proxypassreverse.html

    #21863

    Very good advise, Christian! Thanks :) Perhaps at some point in the future it would be worth creating a feature to change the redirect mode from relative to full URLs. This could be tricky so definitely a PF 4 feature if anything.

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

You must be logged in to reply to this topic.

Comments are closed.