Incorrect font file link in CSS leads to redirect cycle

I made the mistake of adding an @font-face tag to my CSS file which contained an incorrect “src” path specification. The result of this was the page went into a redirect cycle which only ended when the browser complained of “too many redirects”.

In my apache log this looked like this:

> 127.0.0.1 - - [30/Apr/2016:02:13:10 +0200] "GET /Exchange/web/css/fonts/Kontrapunkt-Light.otf HTTP/1.1" 302 372 "http://localhost/Exchange/web/css/style.css" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36"
> 127.0.0.1 - - [30/Apr/2016:02:13:10 +0200] "GET /Exchange/web/css/fonts/account/login.twig HTTP/1.1" 302 372 "http://localhost/Exchange/web/css/style.css" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36"
> 127.0.0.1 - - [30/Apr/2016:02:13:10 +0200] "GET /Exchange/web/css/fonts/account/account/login.twig HTTP/1.1" 302 372 "http://localhost/Exchange/web/css/style.css" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36"
> 127.0.0.1 - - [30/Apr/2016:02:13:10 +0200] "GET /Exchange/web/css/fonts/account/account/account/login.twig HTTP/1.1" 302 372 "http://localhost/Exchange/web/css/style.css" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36"
> 127.0.0.1 - - [30/Apr/2016:02:13:10 +0200] "GET /Exchange/web/css/fonts/account/account/account/account/login.twig HTTP/1.1" 302 372 "http://localhost/Exchange/web/css/style.css" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36"
> 127.0.0.1 - - [30/Apr/2016:02:13:10 +0200] "GET /Exchange/web/css/fonts/account/account/account/account/account/login.twig HTTP/1.1" 302 372 "http://localhost/Exchange/web/css/style.css" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36"
> 127.0.0.1 - - [30/Apr/2016:02:13:10 +0200] "GET /Exchange/web/css/fonts/account/account/account/account/account/account/login.twig HTTP/1.1" 302 372 "http://localhost/Exchange/web/css/style.css" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36"

and so on …

Does anybody know what would be causing this? Could this be a mis-configuration issue on my part? I would expect this to just return a HTTP 404 response and be done with it, but obviously this is not the case here.

Thanks for any ideas.

Can’t say.
Are the css and font files Slim routes? Or do you point to the file directly.
Can you provide some more context code please.

Also, are any of your routes defined with a wildcard in such a way that they would match that route? The redirect loop looks like it is adding /account/login.twig to each previous try, so I’d say the middleware you were working on is being run and trying to redirect.

Hi guys, I don’t think it’s the case of being a route conflict. My routes are as follows:

$app->get  ('/',                 'App\Controller\UserController:home')->setName ('home');
$app->get  ('/dashboard',        'App\Controller\UserController:dashboard')->setName ('dashboard');
$app->get  ('/helpdesk',         'App\Controller\UserController:helpdesk')->setName ('helpdesk');
$app->get  ('/helpdesk/{id}',    'App\Controller\UserController:helpdeskTopic')->setName ('helpdesk_topic');
$app->get  ('/login',            'App\Controller\UserController:login')->setName ('login');
$app->get  ('/login_mp',         'App\Controller\UserController:loginMP')->setName ('login_mp');
$app->get  ('/logout',           'App\Controller\UserController:logout')->setName ('logout');
$app->get  ('/logout_mp',        'App\Controller\UserController:logoutMP')->setName ('logout_mp');
$app->get  ('/register',         'App\Controller\UserController:register')->setName ('register');
$app->get  ('/trade',            'App\Controller\UserController:trade')->setName ('trade');

$app->post ('/helpdesk_topic',   'App\Controller\UserFormController:helpdeskTopic')->setName ('helpdesk_topic.post');
$app->post ('/helpdesk_comment', 'App\Controller\UserFormController:helpdeskComment')->setName ('helpdesk_comment.post');
$app->post ('/login',            'App\Controller\UserFormController:login')->setName ('login.post');
$app->get  ('/login_return_mp',  'App\Controller\UserFormController:loginMP')->setName ('login_mp.post'); // NOTE: this is GET, not POST, it's here for consistency reasons
$app->post ('/register',         'App\Controller\UserFormController:register')->setName ('register.post');

$app->get  ('/test',             'App\Controller\UserController:test')->setName('test');
$app->post ('/test',             'App\Controller\UserFormController:test')->setName('test');

I don’t see how an incorrect link to a CSS file could me matched to any of those routes. I’ll do some more debugging tonight (today being Saturday, the family demands some attention during the day). Thanks for your suggestions & ideas.

Agreed, your routes look okay. I’d look for somewhere that you might be redirecting to account/login.twig as that seems like a clue.

Thanks, I’ll dig further. :slight_smile: