-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AdminFaces redirects over http when using a load balancer #147
Comments
admin.loginPage
redirects me over http
.
I tried adding this to my web.xml:
To automatically redirect each http to https. But after this edit the web page (https://env-2702045.cloudjiffy.net/nights-web-private) through Google Chrome answers like this:
|
I have just reproduced on admin-starter, accessing the login page directly works on https: https://admin-starter-admin-starter.1d35.starter-us-east-1.openshiftapps.com/admin-starter/login.xhtml But when I only access the application context it redirects through http and don't work: https://admin-starter-admin-starter.1d35.starter-us-east-1.openshiftapps.com/admin-starter/ I'll have a look, thanks for reporting. |
I don't know if this fact could help you for this bug: So it seems that somewhere there is an explicit redirect to the http page (otherwise the Where:
Thank you @rmpestano for this library! |
Hi, can you try with 1.0.0-RC21-SNAPSHOT? To use this version you'll need to declare snapshots repository on your pom, see here. I couldn't test because I'm having problems with openshift deploy. I hope it helps |
Hi @rmpestano. |
Can you tell me what's being logged here: admin-template/src/main/java/com/github/adminfaces/template/session/AdminFilter.java Line 247 in 09a3f10
It should be logged only the first time the redirect is done in AdminFilter. OBS: You may need to enable logging for AdminFilter class. |
In my logs, even after the redirect, from
I can't see anything about Thank you for the help. |
Try using log4j, see example here: https://www.mkyong.com/logging/log4j-hello-world-example/ Just follow the example above through item
|
Nothing, still can't see any print in the I added an info log in my code to check if it is working and this is printed on the console.
like this:
|
Try this on log4j.properties: log4j.logger.com.github.adminfaces.template.session.AdminFilter=info Note that the logging of Also, make sure you are using the latest admin-template snapshot, build the application with the -U flag: |
Still nothing new.
And these are my last lines on
Plus these lines after the first redirect:
|
Strange it looks ok, maybe the INFO must be in |
After digging into this issue I found this (losing the https) is a quite common problem caused by load balancers, e.g see here and here. In admin-template the issue occours in any Before this issue we were doing |
Ok now logger prints this in my
|
Can you try again with latest snapshot? Now I'm also looking at server port like spring security does. |
I deleted from my
Could you add a new log.info with |
Done. |
I opened as first url this https://env-2702045.cloudjiffy.net/nights-web-private
|
Maybe now, just for test purposes, we should try without saving the redirectPrefix inside an AdminFilter variable. admin-template/src/main/java/com/github/adminfaces/template/session/AdminFilter.java Lines 240 to 252 in daa262e
Replacing the method with something like this that uses a local variable (for
If the |
I just noticed that passing from |
Hi, do you see the same problem on the showcase page? http://admin-showcase-admin-showcase.7e14.starter-us-west-2.openshiftapps.com/showcase/pages/components/schedule.xhtml Have you cleared browser cache? |
Can't see that page now, I'll open another issue for this thing, I thought that was related with this |
Hi @danielemaddaluno, about the redirect problem I think we will have to force https in some way because all mechanisms to identify the protocol are failing. I really think it is a balancer configuration issue but sometimes we don't have access/permissions to change that config. By forcing the protocol I'm thinking in using a system property or env variable named I've tested in openshift and it worked, see here: https://admin-admin-starter.1d35.starter-us-east-1.openshiftapps.com/admin-starter/ On openshift I've added the property on the deployment configuration: |
Latest admin-template snasphot has the admin.protocol mechanism |
It would be nice to be able to set it both from env variables and from However putting this code below in the
Let me know I there exist some cheats for this thing too. Thank you again and again @rmpestano |
"It would be nice to be able to set it both from env variables and from resources/admin-config.properties file" I think forcing the protocol in admin-config.properties will make the application stop to work locally on dev machine or e.g in pre-production where sometimes we don't have https. It makes sense for you? I'll take a look on the security-constraint config. |
Yeah you are right but if it was possible to set On my local dev machine I can open both: I'm using Wildfly with Spring Tools 3 for Eclipse. |
I think It is not a good idea to have infrastructure configuration in admin-config. I will have a look into the redirect loop asap. |
With the Looking at the logs it doesn't reach AdminFilter because I see nothing on logs. locally it is working: Again, it looks like a infrastructure thing rather then adminfaces, see here: https://developer.jboss.org/thread/272606?_sscc=t Do you have other (JavaEE) applications using this setup () working on the cloud without issues? |
Or you can just disable admin filter, in admin-config.properties, to see if the application still works:
|
Sorry for being late in the answer. I first tried these two solutions to force http to https: However just for the sake of knowledge I finally solved the redirect problem adding a layer of "Nginx load balancer" adding this redirect rule as stated here:
Thank you for the patience @rmpestano |
Great, also thank you for the interaction here, for sure AdminFaces wasn't working with any balancer before due to it's relative |
Issue Overview
admin.loginPage
always redirects me overhttp
.Expected Behaviour
Opening a private page with
https
should redirect me to the loginPage throughhttps
if I'm not logged in.How to reproduce
My admin-config.properties is like this:
My AdminSession specialization is like this:
My deployment root is under
nights-web-private
.For example if I open this link in
https
(I deployed for test purpose theear
on cloudjiffy. It will be available online just for a short period):https://env-2702045.cloudjiffy.net/nights-web-private
I am redirected to
http://env-2702045.cloudjiffy.net/nights-web-private/public/sign/signin.xhtml over a simple
http
.Additional Information
I don't know if I'm missing something but it seems like the
AdminFilter
class inside thedoFilter
method does not take in account that I'm coming to this page from https. Maybe it's something related to theredirectToLogon
method.The text was updated successfully, but these errors were encountered: