According to the Nginx reference. http://nginx.org/en/docs/http/ngx_http_sub_module.html
Syntax: sub_filter string replacement;
Default: —
Context: http, server, location
We noticed that we can add the sub_filter
in server
context.
So we could add the sub_filter
outside or location
block.
Just see
server {
# 巴拉巴拉 Omitted
location / {
# Left this block alone as Flarum default
try_files $uri $uri/ /index.php?q=$uri&$args;
}
# 巴拉巴拉 Omitted
sub_filter_types *;
sub_filter "https://cdn.jsdelivr.net/npm/emojionearea@3.4.2/dist/emojionearea.min.js" "https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/emojionearea/3.4.2/emojionearea.min.js";
sub_filter "https://cdn.jsdelivr.net/npm/emojionearea@3.4.2/dist/emojionearea.min.css" "https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/emojionearea/3.4.2/emojionearea.min.css";
sub_filter_once off;
}
By the way, we could see the file https://cdn.jsdelivr.net/npm/emojionearea@3.4.2/dist/emojionearea.min.js also refer jsdelivr. So clarkwinkelmann/flarum-ext-emojionearea
could not work neither. (悲 so sad)