JSF for Apache with SSL - h: commandLink with and without f: ajax

[ Edit ] - Thanks for the comments. I tried to formulate my question accordingly, and I added additional information based on the proposed proposals.

I have a JSF web application running on JBoss AS7 that I use with Apache on SSL (port 443). Apache and JBoss work on the same computer and transmit "in a clear" form via HTTP using reverse proxy forwarding rules. With this setting, I noticed that clicking on any link created using the JSF tag <h:commandLink> (i.e. Without <f:ajax> ) and where there is always a bean support method that returns after executing some business logic a result with the suffix ?faces-redirect=true ) will cause page redirection to fail because the https scheme is discarded and replaced with http .

If I replace all instances of <h:commandLink> with <h:commandLink><f:ajax/></h:commandLink> , this redirect problem will disappear - that is, the https scheme is saved as a result of the redirected URL.

Can someone explain to me what I'm observing, and what could be the difference between the β€œnon-working” difference between the form without the ajax and ajax submit in this case?

Additional Information:

My Apache reverse proxy rules:

 ProxyRequests Off ProxyPreserveHost On <Proxy *> Order Allow,Deny Allow from all </Proxy> ProxyPass / http://localhost:8080/ timeout=1800 ProxyPassReverse / http://localhost:8080/ 

The Firefox web console shows the difference between the submission form of the ajax form and the non-ajax form sending HTTP requests as:

Ajax submit via <h:commandLink><f:ajax/></h:commandLink>

I see a GET request for the expected page on https (I still cannot post screenshots)

Non-ajax submit via <h:commandLink/>

The non-addex version first returns POST to the same page (which is expected) on https with a status code of 302 "Moved temporarily", and then redirects to the target page from the action method on http .

Location in HTTP header for POST before fail GET redirect to http

Here is a screenshot. The location value for the POST is displayed as the URL of the GET request, on http , not https :

enter image description here

I guess now I'm a little "under the hood." Since the <f:ajax> approach achieves the desired result, I am happy to leave it alone. There seems to be at least a few other JSF posts related to the same things (here is the only URL that I am allowed to post):

JSF redirects from HTTPS to HTTP

Maybe an ajax-based approach is needed to save the scheme in the url coming from the client?

Thanks,

-Andy

+4
source share

All Articles