禁止用户发布文章
来源:本站原创
点击数: 次
发布时间:2026年05月09日
来自客户的特殊要求,某个时间段所有管理员无法发布文章,但是能访问后台
WebFuture目前没有相关设置
发现WebFuture发布文章是向contentmanage/article/approverelease发出请求,那可以在Nginx对这个路径的请求作转发处理。
http {
# 提取本地时间中的“小时”部分
map $time_local $api_disabled {
default 0;
# 正则匹配:如果小时在 02, 03, 04 之间
"~^.*/.*/.*:0[2-4]:" 1;
}
server {
listen 80;
location /contentmanage/article/approverelease {
if ($api_disabled) {
return 403 "Service is unavailable during maintenance (02:00-05:00).";
}
proxy_pass http://your_backend;
}
}
}