[SOLVED] Fail to Redirect to login page

Moderator: crythias

Post Reply
SuperDOS
Znuny newbie
Posts: 93
Joined: 17 Apr 2012, 16:16
Znuny Version: 6.0.3
Real Name: A!

[SOLVED] Fail to Redirect to login page

Post by SuperDOS »

Hi,

Running otrs 4.0.9 on OpenSuse 13.2 with apache 2.4

For some reason I can't get the redirection to work with my FQDN
So I have to type https://support.domain.com/otrs/index.pl or /otrs/customer.pl

In the apache log i get 403 error so it should redirect to /otrs/index.pl...

Any ideas?

Here's my otrs.conf under /etc/apache2/conf.d

Code: Select all

# --
# added for OTRS (http://otrs.org/)
# --
ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/"
Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs/"

<IfModule mod_perl.c>

    # Setup environment and preload modules
    Perlrequire /opt/otrs/scripts/apache2-perl-startup.pl

    # Reload Perl modules when changed on disk
    PerlModule Apache2::Reload
    PerlInitHandler Apache2::Reload

    # general mod_perl2 options
    <Location /otrs>
#        ErrorDocument 403 /otrs/customer.pl
        ErrorDocument 403 /otrs/index.pl
        SetHandler  perl-script
        PerlResponseHandler ModPerl::Registry
        Options +ExecCGI
        PerlOptions +ParseHeaders
        PerlOptions +SetupEnv

        <IfModule mod_version.c>
            <IfVersion < 2.4>
                Order allow,deny
                Allow from all
            </IfVersion>
            <IfVersion >= 2.4>
                Require all granted
            </IfVersion>
        </IfModule>
        <IfModule !mod_version.c>
            Order allow,deny
            Allow from all
        </IfModule>
    </Location>

    # mod_perl2 options for GenericInterface
    <Location /otrs/nph-genericinterface.pl>
        PerlOptions -ParseHeaders
    </Location>

</IfModule>

<Directory "/opt/otrs/bin/cgi-bin/">
    AllowOverride None
    Options +ExecCGI -Includes
    <IfModule mod_version.c>
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
    </IfModule>
    <IfModule !mod_version.c>
        Order allow,deny
        Allow from all
    </IfModule>

    <IfModule mod_filter.c>
        <IfModule mod_deflate.c>
            AddOutputFilterByType DEFLATE text/html text/javascript application/javascript text/css text/xml application/json text/json
         </IfModule>
    </IfModule>

</Directory>

<Directory "/opt/otrs/var/httpd/htdocs/">
    AllowOverride None

    <IfModule mod_version.c>
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
    </IfModule>
    <IfModule !mod_version.c>
        Order allow,deny
        Allow from all
    </IfModule>

    <IfModule mod_filter.c>
        <IfModule mod_deflate.c>
            AddOutputFilterByType DEFLATE text/html text/javascript application/javascript text/css text/xml application/json text/json
         </IfModule>
    </IfModule>

    # Make sure CSS and JS files are read as UTF8 by the browsers.
    AddCharset UTF-8 .css
    AddCharset UTF-8 .js

    # Set explicit mime type for woff fonts since it is relatively new and apache may not know about it.
    AddType application/font-woff .woff

</Directory>

<IfModule mod_headers.c>
    # Cache css-cache for 30 days
    <Directory "/opt/otrs/var/httpd/htdocs/skins/*/*/css-cache">
        <FilesMatch "\.(css|CSS)$">
            Header set Cache-Control "max-age=2592000 must-revalidate"
        </FilesMatch>
    </Directory>

    # Cache css thirdparty for 4 hours, including icon fonts
    <Directory "/opt/otrs/var/httpd/htdocs/skins/*/*/css/thirdparty">
        <FilesMatch "\.(css|CSS|woff|svg)$">
            Header set Cache-Control "max-age=14400 must-revalidate"
        </FilesMatch>
    </Directory>

    # Cache js-cache for 30 days
    <Directory "/opt/otrs/var/httpd/htdocs/js/js-cache">
        <FilesMatch "\.(js|JS)$">
            Header set Cache-Control "max-age=2592000 must-revalidate"
        </FilesMatch>
    </Directory>

    # Cache js thirdparty for 4 hours
    <Directory "/opt/otrs/var/httpd/htdocs/js/thirdparty/">
        <FilesMatch "\.(js|JS)$">
            Header set Cache-Control "max-age=14400 must-revalidate"
        </FilesMatch>
    </Directory>
</IfModule>

# Limit the number of requests per child to avoid excessive memory usage
MaxRequestsPerChild 4000
Last edited by SuperDOS on 30 Jun 2015, 09:25, edited 2 times in total.
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Re: Fail to Redirect to login page

Post by aph »

check index.html under /opt/otrs/var/httpd/htdocs/
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
SuperDOS
Znuny newbie
Posts: 93
Joined: 17 Apr 2012, 16:16
Znuny Version: 6.0.3
Real Name: A!

Re: Fail to Redirect to login page

Post by SuperDOS »

it's there:

Code: Select all

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    <meta http-equiv="refresh" content="0; URL=/otrs/index.pl" />
    <title>OTRS Redirect</title>
</head>
<body>
</body>
</html>

<!--
index.html - redirect
Copyright (C) 2001-2013 xxx, http://otrs.org/

This software comes with ABSOLUTELY NO WARRANTY. For details, see
the enclosed file COPYING for license information (AGPL). If you
did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
-->
eandrex
Znuny expert
Posts: 213
Joined: 04 Nov 2012, 23:58
Znuny Version: OTRS 4.x
Real Name: Esteban
Company: NORTON DE COLOMBIA

Re: Fail to Redirect to login page

Post by eandrex »

Try adding a few directives to your apache configuration.

Code: Select all

DocumentRoot /opt/otrs/var/httpd/htdocs
DirectoryIndex index.html
SuperDOS
Znuny newbie
Posts: 93
Joined: 17 Apr 2012, 16:16
Znuny Version: 6.0.3
Real Name: A!

Re: Fail to Redirect to login page

Post by SuperDOS »

in the otrs.conf ?

tried adding your lines and restarted apache.
Still doesn't work.
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Re: Fail to Redirect to login page

Post by aph »

in httpd.conf
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
SuperDOS
Znuny newbie
Posts: 93
Joined: 17 Apr 2012, 16:16
Znuny Version: 6.0.3
Real Name: A!

Re: Fail to Redirect to login page

Post by SuperDOS »

Nope,

Code: Select all

Access forbidden!

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.

Error 403
inte apache error log
[Thu Jun 25 15:00:12.156282 2015] [autoindex:error] [pid 19339] [client 192.168.100.67:55320] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive

update:

added /srv/www/htdocs/index.html now i get:
192.168.100.67 - - [25/Jun/2015:15:04:05 +0200] "GET /otrs/customers.pl HTTP/1.1" 404 1159
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Fail to Redirect to login page

Post by crythias »

SuperDOS wrote:For some reason I can't get the redirection to work with my FQDN
What, exactly, did you change and where ... what's the specific way that you set the FDQN to redirect?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
SuperDOS
Znuny newbie
Posts: 93
Joined: 17 Apr 2012, 16:16
Znuny Version: 6.0.3
Real Name: A!

Re: Fail to Redirect to login page

Post by SuperDOS »

Nothing really, its out of the box, I've enabled SSL.
Just now I've copied the Index.html to /srv/www/htdocs
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Fail to Redirect to login page

Post by crythias »

SuperDOS wrote:Nothing really, its out of the box, I've enabled SSL.
Just now I've copied the Index.html to /srv/www/htdocs
There is no out of the box FQDN redirection. I, personally, use a meta refresh on index.html.

Code: Select all

<meta http-equiv="refresh" content="0; url=http://FQDN/otrs/index.pl" />
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
SuperDOS
Znuny newbie
Posts: 93
Joined: 17 Apr 2012, 16:16
Znuny Version: 6.0.3
Real Name: A!

Re: Fail to Redirect to login page

Post by SuperDOS »

Hmm ok, the weird thing is that I got this working with the same index-files on another system with FQDN and no trailing /otrs/index.pl
not the same apache version tough.

added your redirection but now it tries to go to /otrs/customers.pl
[25/Jun/2015:15:47:29 +0200] "GET /otrs/customers.pl HTTP/1.1" 404 1159

But in all the files there is configures /otrs/index.pl

Must be missing something.

Update: tried another browser

Now it goes to
https://fqdn/otrs/index.pl
SuperDOS
Znuny newbie
Posts: 93
Joined: 17 Apr 2012, 16:16
Znuny Version: 6.0.3
Real Name: A!

Re: Fail to Redirect to login page

Post by SuperDOS »

Must be my SSL Config

Any ideas?

Code: Select all

<IfDefine SSL>
<IfDefine !NOSSL>

##
## SSL Virtual Host Context
##

<VirtualHost _default_:443>

	#  General setup for the virtual host
	DocumentRoot "/srv/www/htdocs"
	#ServerName www.example.com:443
	#ServerAdmin webmaster@example.com
	ErrorLog /var/log/apache2/error_log
	TransferLog /var/log/apache2/access_log

	#   SSL Engine Switch:
	#   Enable/Disable SSL for this virtual host.
	SSLEngine on

	#   You can use per vhost certificates if SNI is supported.
	SSLCertificateFile /etc/apache2/ssl.crt/otrs.crt
	SSLCertificateKeyFile /etc/apache2/ssl.key/otrs.key
	#SSLCertificateChainFile /etc/apache2/ssl.crt/vhost-example-chain.crt

	#   Per-Server Logging:
	#   The home of a custom SSL log file. Use this when you want a
	#   compact non-error SSL logfile on a virtual host basis.
	CustomLog /var/log/apache2/ssl_request_log   ssl_combined

</VirtualHost>
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTPS} off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
#RewriteEngine on
#RewriteCond %{SERVER_PORT} !^443$
#RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R=301,L]
</VirtualHost>

</IfDefine>
</IfDefine>
SuperDOS
Znuny newbie
Posts: 93
Joined: 17 Apr 2012, 16:16
Znuny Version: 6.0.3
Real Name: A!

Re: Fail to Redirect to login page

Post by SuperDOS »

now it just loops trying to redirect
29/Jun/2015:09:56:03 +0200] "GET / HTTP/1.1" 304

do anyone have any good SSL config?
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Fail to Redirect to login page

Post by crythias »

I personally don't know what you want to accomplish in explicit terms. Your two posts previous didn't exactly indicate a problem to be fixed. I would have expected that you might have modified the redirect to use https and the full URI of the true destination.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
SuperDOS
Znuny newbie
Posts: 93
Joined: 17 Apr 2012, 16:16
Znuny Version: 6.0.3
Real Name: A!

Re: Fail to Redirect to login page

Post by SuperDOS »

Hi, I try to get apache to redirect from the FQDN like support.company.com to support.company.com/otrs/index.pl
This is working on my other test system but since adding SSL in the mix I think there's something wrong which I can't figure out :)
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Fail to Redirect to login page

Post by crythias »

We can't fix "something wrong".
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
SuperDOS
Znuny newbie
Posts: 93
Joined: 17 Apr 2012, 16:16
Znuny Version: 6.0.3
Real Name: A!

Re: Fail to Redirect to login page

Post by SuperDOS »

sorry, I got it working.
My mistake , added an extra " at URL <meta http-equiv="refresh" content="0; URL="/otrs/index.pl" />
Changed to <meta http-equiv="refresh" content="0; URL=/otrs/index.pl" />

the only thing to fix is the trailing /otrs/index.pl
SuperDOS
Znuny newbie
Posts: 93
Joined: 17 Apr 2012, 16:16
Znuny Version: 6.0.3
Real Name: A!

Re: Fail to Redirect to login page

Post by SuperDOS »

Ok, if I skip using the index.html redirection and only use ErrorDocument 403 /otrs/customer.pl the trailing /otrs/customer.pl isn't there.
Also these settings had to be added to the SSL-config not the otrs.config
case closed. :)
Post Reply