Forum Moderators: phranque
I have setups a Apache-Liferay-MySQL setup each on 3 different servers.
Configured ProxyPass and ProxyPassReverse poiting to Liferay server listening on port 8080
This configuration is working fine.
Now I installed ssl certificate on the Apache server and configured ssl.conf with values for required directive.
I opened httpd.conf and added following lines to force to use https:
RewriteEngine On
#forces everything under /web/guest/signup to secure if non-secure (https)
RewriteCond %{SERVER_PORT} =80
RewriteRule ^(/web/guest/signup.*)$ [%{SERVER_NAME}:443$1...] [R,L]
RewriteRule ^(/web/guest/change-of-details.*)$ [%{SERVER_NAME}:443$1...] [R,L]
RewriteRule ^(/c/portal/login.*)$ [%{SERVER_NAME}:443$1...] [R,L]
But now the problem is when I login as a user..it is redirecting back to /web/guest/home page.
When I remove these lines then..https is not forced on to Liferay pages, can view the application pages. and if I add these lines, I am not able login to view other pages.
Also, it won't be necessary to explicitly include the ":443" port number on the redirection URLs; Port 443 is implied by redirecting using the "https:" protocol.
Use a 301 redirect, unless this function is to be temporary... Specify "[R=301,L]"
Jim
I did add RewriteCond before every rule. But still I am getting redirected to /web/guest/home.
I dont know from where its picking up /web/guest/home every time when I login to the app using https.
I am not very clear about the keys used in this directive
it would of some help to know following:
what does $1 store?
Does %{SERVER_PORT} work on all operating systems, esp on RH Linux.
let me know if there is good guide to get this working on Linux.
Temporary variables $1 through $9 store the value of the requested URL-path parts that match the first through ninth parenthesized sub-expressions in the RewriteRule's regular-expressions pattern. In your code, only one parenthesized sub-expression is present, so $2 through $9 are not used.
> Does %{SERVER_PORT} work on all operating systems, esp on RH Linux.
SERVER_PORT is an Apache variable, not an OS variable. Therefore, it will "work" on any OS.
A good place to start for mod_rewrite and regular-expressions questions is with the references cited in our Apache Forum Charter [webmasterworld.com].
Since none of your rules will redirect directly to /web/guest/home, it appears that your script is doing a second redirect in response to each of the https requests invoked by the client in response to your https redirects. I'd suggest asking about this in the forum provided by your applications server, or calling their help desk.
Jim