jeroennoten / Laravel-Prerender

Laravel middleware for prerendering javascript-rendered pages on the fly for SEO

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regex does not work in black/white lists

opened this issue · comments

When checking if a url is in the black/white lists, you're using laravel's str_is function here https://github.com/JeroenNoten/Laravel-Prerender/blob/master/src/PrerenderMiddleware.php#L217

This function is an alias for the Str::is static method here https://github.com/laravel/framework/blob/5.2/src/Illuminate/Support/Str.php#L119-L133

If you read that method you can see this portion here

$pattern = preg_quote($pattern, '#');

This effectively removes any regular expressions from the string. The str_is is only meant to work with asterisks, and does not allow any regex at all.

In order to keep backward compatibility, you'd need to still implement the asterisk behavior that str_is does, so you can't do a straight replacement of it with preg_match. You'd have to do a similar thing that Str::is does by replacing '*' with '.*'.

Just saw issue #8. I guess no support for regex... closing.