我想在运行时使用NGINX子filterreplacejs文件中的IP。
我已经添加了sub_filter的位置,但它不工作。
我的nginx.config文件是
location ~ \.js { sub_filter "###IP###" "$remote_addr"; sub_filter_once off; sub_filter_types application/x-javascript; add_header Content-Type application/x-javascript; }
而我的JS代码是
var IP = "###IP###"; console.log(IP);
但IP在这样的控制台中打印###IP###
我的代码中有什么问题?