Message Boards

how to auto-redirect to https

Scarletake Bwi, modified 3 Years ago.

how to auto-redirect to https

Expert Posts: 326 Join Date: 12/20/10 Recent Posts

hi

 

i use 6.2, i try to add ssl, follow the steps with

https://liferay.dev/blogs/-/blogs/ssl-configuration-in-liferay-https-

it works.

but when try access it, the first time in welcom page, it does not redirect to https, only after i do somthing.

my question are:

1. how can i access https directly, 

2. in this artical, i have to add code in web.xml, but i found many web.xml in many folder, should i just modify <liferay6.2>/tomcat-7.0.62/conf/web.xml? or web.xml from my ext project?

for now, i add javascript

if(window.location.protocol!='https:'){window.location.replace("https://my liferay6.2/"); }

in my welcome page.

thumbnail
Christoph Rabel, modified 3 Years ago.

RE: how to auto-redirect to https (Answer)

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts

The config in the blog should work in general, but you need to edit the web.xml in tomcat/webapps/ROOT/WEB-INF/. Note: When you edit and save it, the server crashes (probably). So, I would only edit the file when the server is stopped.

General advice: Could you add a reverse proxy? Believe me, things like redirects and certificates are far easier to manage on a reverse proxy like Apache or Nginx.

Scarletake Bwi, modified 3 Years ago.

RE: RE: how to auto-redirect to https

Expert Posts: 326 Join Date: 12/20/10 Recent Posts

thank you

i find the reason i failed.

because my server be triggered by eclipse, so, it copy the web.xml from <eclipse wrokspase>/servers/<Liferay 6.2 CE(Tomcat) from local>/web.xml