【发布时间】:2020-03-29 07:52:02
【问题描述】:
当前的 API 端点是这样的
domain.com/api/rest/[actual_module_routing_path, eg. cms/page/home]
在新系统中,这必须类似于
domain.com/rest/V1/$1
无论 HTTP 方法(GET、POST、PUT、DELETE)如何,它都必须工作。在 nginx 主机配置中尝试这样的事情,但我无法让它工作,非常感谢一些帮助
location /api/rest {
#Rewrite $uri=/api/rest/ back to just $uri=/rest/V1/$1
rewrite ^/api/rest/(.*)$ /rest/V1/$1 break;
}
【问题讨论】:
标签: nginx mod-rewrite nginx-location