[SOLVED] - Forcing HTTPS access only in OTRS

Moderator: crythias

Locked
retro2707
Znuny advanced
Posts: 131
Joined: 16 Apr 2014, 17:06
Znuny Version: 6.0.12

[SOLVED] - Forcing HTTPS access only in OTRS

Post by retro2707 »

Hi,

I followed the articlehttps://huntingbears.nl/2015/01/25/usin ... with-otrs/ and set OTRS with SSL. This works but now I want to turn off HTTP access to the site, the problem is that the guide talks about adding the following lines to the apache HTTP virtualhost configuration:

Code: Select all

RewriteEngine On
RewriteCond %{HTTPS} off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
The problem is that I dont appear to have an entry <VirtualHost *:80></Virtualhost> where I can put this config. I have checked in /etc/httpd/conf and conf.d but cant find anything. Do I set one up from scratch in httpd.conf or is there another way to sort this?

Im a bit of a newbie to apache so apologies if this is a bit of a basic question!

Thanks a lot!

Brendan
Last edited by retro2707 on 19 Jul 2016, 13:26, edited 1 time in total.
Setup:
OTRS 6.0.12
Hosted on CentOS 7.4/ MySQL - MariaDB (5.5.60)
wurzel
Znuny guru
Posts: 3270
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: Forcing HTTPS access only in OTRS

Post by wurzel »

Hi,

you should ask in a apache forum. The chances of getting correct answers is much more higher.

for me, I do not have expertise in rewriting. I actually block port 80 completely

Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
Charmacas
Znuny advanced
Posts: 103
Joined: 18 Jan 2016, 10:27
Znuny Version: 5.0.26 on Debian 8

Re: Forcing HTTPS access only in OTRS

Post by Charmacas »

If it's apache then you have to look at /etc/apache2/sites-enabled/000...

There you find what you're looking for. :-)
retro2707
Znuny advanced
Posts: 131
Joined: 16 Apr 2014, 17:06
Znuny Version: 6.0.12

Re: Forcing HTTPS access only in OTRS

Post by retro2707 »

Hi,

Thanks for the replies. I have asked in an apache forum and they say that I need to find the virtualhost configuration file/ entry, the problem is that I cannot find this. I dont know how OTRS works on the web side.

@Charmacs - I think thats the debian location. For me its /etc/httpd/. I have checked in here but cannot find anything relating to virtualhost for port 80.

I could just block port 80 but really I wanted to replace the error page with something descriptive like "Please use HTTPS to access this site" rather than just a BLOCKED error.
Setup:
OTRS 6.0.12
Hosted on CentOS 7.4/ MySQL - MariaDB (5.5.60)
wurzel
Znuny guru
Posts: 3270
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: Forcing HTTPS access only in OTRS

Post by wurzel »

OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
skullz
Znuny superhero
Posts: 656
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Re: Forcing HTTPS access only in OTRS

Post by skullz »

Under /etc/httpd/conf/httpd.conf OR /etc/httpd/conf.d/zzz_otrs.conf

Add the end of file

Code: Select all


(+) RewriteEngine On
(+) RewriteCond %{HTTPS} off
(+) RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
restart httpd afterwards
My Github
OTRS CE/LTS Discord Channel
Cant Update Package Anymore ? Check This

Professional OTRS, Znuny & OTOBO services: efflux.de/en
Free and premium add-ons: English
retro2707
Znuny advanced
Posts: 131
Joined: 16 Apr 2014, 17:06
Znuny Version: 6.0.12

Re: Forcing HTTPS access only in OTRS

Post by retro2707 »

Hi and thanks for replying.

Unfortunately that didnt work.

I ended up putting the following code in the HTTPD.conf file and restarting the HTTPD service

Code: Select all

NameVirtualHost *:80
<VirtualHost *:80>
   ServerName servicedesk.domain.com
   Redirect permanent / https://servicedesk.domain.com/
</VirtualHost>
Setup:
OTRS 6.0.12
Hosted on CentOS 7.4/ MySQL - MariaDB (5.5.60)
Locked