Bad redirection when using Google OAuth

Hello !

I installed XWiki Enterprise 9.4 on our server, using a war package and following this tutorial How to Install XWiki on CentOS 7 | LinuxCloudVPS Blog
(This means I’m running on MySQL and tomcat).

To access the wiki, I’m using an Apache reverse proxy, configured like this:

ProxyPass /xwiki http://127.0.0.1:8080/xwiki
ProxyPassReverse /xwiki http:/mydomain.com/xwiki

Everything is working fine, I can login, create pages/users, etc. without problems. I installed the Google Apps Application to enable OAuth login with XWiki, but I have a strange problem. I configured everything (xwiki.cfg + Google Client API), and when I click on “Login with Google”, I am redirected well to Google to input user and password, but then I’m redirected, when login-in successfully, to

http://127.0.0.1:8080/xwiki/bin/view/GoogleApps/Login??Xredirect=%2Fxwiki%2Fbin%2Fview%2FMain%2FAllDocs#

Why do I have a local URL here ? I traced back the construction of the URL in the AuthService file of the Google Apps Application extension:

def url = context.getWiki().getURL(“GoogleApps.Login”, “view”, context)

It is called using sendRedirect(), so I do not understand this behavior.
The weird thing happening is that if I go back (using backward in the browser) to the login page, when I click on “Login with Google”, I’m automatically login-in ! Any idea of what is happening ?

Two suggestions for your reverse proxy configuration:

a)
AllowEncodedSlashes On

b)
ProxyPass /xwiki http://127.0.0.1:8080/xwiki
ProxyPassReverse /xwiki http://127.0.0.1:8080/xwiki/
ProxyPass /xwiki/ http://127.0.0.1:8080/xwiki
ProxyPassReverse /xwiki/ http://127.0.0.1:8080/xwiki/

HTH

Hello,

Thanks a lot for your help, the addition of the lines

ProxyPass /xwiki http://127.0.0.1:8080/xwiki
ProxyPassReverse /xwiki http://127.0.0.1:8080/xwiki

in the Apache configuration file did the trick !