hplush / slowreader

Web app to combine feeds from social networks and RSS and to help read more meaningful and deep content
https://dev.slowreader.app
GNU Affero General Public License v3.0
161 stars 37 forks source link

Avoid using JS in nginx #163

Closed ai closed 7 months ago

ai commented 7 months ago

Motivation

The new way is simpler and should be faster.

Script now exports a single RegExp, which we insert to nginx.conf in Dockerfile.

cc @easing

easing commented 7 months ago

Nice way. I'm surprised that RegExp.source works in Nginx without any modification :)

However regexp flags are not exported and final rules will be case-sensitive. To make them case-insensitive (as in nanostores/router) Nginx location can be definded this way:

location ~* __ROUTES__ {
 #...
}

Regular expressions are specified with the preceding “\~*” modifier (for case-insensitive matching), or the “~” modifier (for case-sensitive matching) https://nginx.org/en/docs/http/ngx_http_core_module.html#location

ai commented 7 months ago

@easing thanks! Fixed https://github.com/hplush/slowreader/pull/163/commits/5866d13444a4cc05756b1daba8bb516fd4625cd2