【发布时间】:2017-07-05 14:16:04
【问题描述】:
假设我们有 url http://example.com/blog/posts,我们想使用 Nginx 作为转发代理,将该请求定向到只会将该 url 视为 http://example.com/my-blog/foo/posts 的后端。
使用 nginx、没有重定向并且对后端完全透明,这怎么可能?
到目前为止,我们有以下内容:
rewrite ^/blog/(.*)$ /my-blog/foo$ last;
目前我们的日志显示如下:
*1 "^(.*)$" matches "/blog/posts"
*1 rewritten data: "/my-blog/foo/posts"
GET /blog/posts HTTP/1.1" 404
【问题讨论】:
标签: http nginx docker proxy url-rewriting