-
-
Notifications
You must be signed in to change notification settings - Fork 88
Closed
Description
Recently I installed this addon to Google Chrome:
https://chrome.google.com/webstore/detail/host-switch-plus/bopepoejgapmihklfepohbilpkcdoaeo
its purpose is something like etc/hosts file with one single exception. If used, it sends HTTP requests like:
GET http://www.example.com/ HTTP/1.1
instead of
GET / HTTP/1.1
which seems to be valid according to https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html
But Nette shows "no routes" and gives me 404.
Because RequestFactory.php where $_SEVER['REQUEST_URI'] is parsed cannot handle absolute URLs. I quick-fixed this simply by modifying urlFilters from:
/** @var array */
public $urlFilters = array(
'path' => array('#/{2,}#' => '/'), // '%20' => ''
'url' => array(), // '#[.,)]\z#' => ''
);
to:
/** @var array */
public $urlFilters = array(
'path' => array('#/{2,}#' => '/'), // '%20' => ''
'url' => array('#^(http|ftp)s?://[^/]+/#' => '/'), // '#[.,)]\z#' => ''
);
and it works, but I'm not sure if this is the best way to "fix" this.
Metadata
Metadata
Assignees
Labels
No labels