У меня есть веб-приложение, работающее на платформе PHP Codeigniter, которое использует правила перезаписи для перезаписи маршрутов к переднему контроллеру index.php. Я хочу исключить один маршрут из аутентификации shibboleth.
Пример:
У нас есть 2 маршрута https://example.com/view/1457 и https://example.com/public/view/1457. Первая ссылка должна требовать от пользователя входа через Shibbo, а вторая - нет. Оба маршрута переписываются на https://example.com/index.php?/view/1457 и https://example.com/index.php?/public/view/1457. У меня есть одно правило перенаправления в apache conf, чтобы перенаправить view / public / 12345 на public / view / 12345. Другой маршрут, не связанный с шиббо, - это / assets, который содержит статические файлы (css, js, ...)
Моя проблема в том, что общедоступные маршруты и маршрут перенаправления на общедоступный (view / public / 12345) перехватываются логином shibbo. Но на пути к активам нет.
Для меня это похоже на запрос к https://example.com/public/view/1457 переписано на https://example.com/index.php?/public/view/1457, и этот маршрут не включен в белый список. Но после входа я перенаправляюсь на этот URL-адрес https://example.com/public/view/1457
.htaccess
Options -Indexes
DirectoryIndex index.php index.html index.htm
RewriteEngine On
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
Конфигурация виртуального хоста Apache
<VirtualHost *:443>
ServerName example.com
#legacy redirection
Redirect /view/public/12345 https://example.com/public/view/12345
DocumentRoot /var/www/html
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Location /public>
AuthType shibboleth
ShibRequireSession Off
require shibboleth
</Location>
<Location /assets>
AuthType shibboleth
ShibRequireSession Off
require shibboleth
</Location>
<Location />
AuthType shibboleth
ShibRequireSession On
ShibUseHeaders On
require valid-user
require shibboleth
</Location>
</VirtualHost>