如何解决生产vs开发API调用被重定向到前端
我知道这很模糊,但希望我会对此进行更新,以便在人们提出问题时就足够了。
我们有一个DEV和PROD apache服务器。我们简单的get API调用可在PROD中使用。您调用API,并以json格式返回数据。
现在我们的DEV服务器具有相同的Apache配置,并且重写条件相同,但是,在调用DEV API时,用户将被重定向到前端应用程序(以角度编写)。
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} /api/.* [OR]
#L(ast) flag,if this rule is used stop the rewriting process immediately and don't apply any more rules
RewriteRule ^ - [L] #for all matching,pass the existing path through unmodified
# If above rule did not direct to an existing document,default to index.html
RewriteRule ^ /index.html
由于apache的配置文件相同,所以我很困惑为什么在DEV中重定向用户。我希望DEV中的API调用能够以类似于PROD的json格式返回数据。
解决方法
路由必须从一台服务器更改为另一台
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。