【发布时间】:2013-09-24 17:20:54
【问题描述】:
我有带有牛仔和 angular.js 的 erlang Web 应用程序。
我启动了我的应用程序,在“/”中打开了浏览器,并得到了带有 <input> 和 <button> 的 main.html。当我按下按钮时,我向服务器发送 http POST 请求到带有角度 $http 的 /join/username,在服务器上得到这个 POST 请求并将重定向发送到浏览器:
{ok, Req4} = cowboy_req:reply(303, [{"Location", <<"/chat.html">>}], <<"">>, Req3)
{:ok, req4, State}
重定向响应标头:
HTTP/1.1 303 See Other
connection: keep-alive
server: Cowboy
date: Thu, 19 Sep 2013 14:36:01 GMT
content-length: 0
Location: /chat.html
Cache-Control: no-store
发送重定向后,我收到来自浏览器的“GET”请求,路径为“/chat.html”,没关系。我阅读了 chat.html 并将其发送回浏览器,但浏览器没有呈现它,并且浏览器中的 url 也没有改变。我在浏览器控制台中看到了 chat.html 200。
为什么浏览器不呈现新页面 - chat.html?
UPD 1.
如果我在浏览器中手动输入/join/username,它会正常重定向。为什么?
谢谢。
【问题讨论】:
标签: ajax http redirect erlang cowboy