nginx - NGINX 根据端点重定向到不同的服务器
问题描述
我需要将请求重定向http://example.com/api/v1
到http://sub.example.com/api/v1
和http://example.com/
http://another-example.com/
这是我到目前为止所尝试的:
server {
listen 80;
server_name http://example.com/api/v1;
return 200 http://sub.example.com/api/v1$request_uri;
它有效,现在我正在尝试添加类似的内容:
server_name http://example.com/;
return 200 http://another-example.com/$request_uri;
重定向不起作用,我做错了什么?
解决方案
推荐阅读
- androidx - 如何将 AndroidX 迁移到 Android?
- oracle - 我可以编译下面的SP吗
- java - 如何将 jsonArray 转换为 List
爪哇? - github - 使用graphql github api过滤两个日期之间合并的pr
- java - 为什么我的 Java 服务器代码在尝试从条带接收 webhook 时抛出 502 错误?
- objective-c - 优化 - 拉入局部变量或留给编译器?
- java - Mybatis xml resultMap与集合和关联问题
- openshift - MiniShift 无法部署简单的 Java 应用程序
- javascript - 如何在javascript中替换对象属性名称的数组
- javascript - 如何使用自定义标签插件在 Hexo 中渲染获取的数据?