【发布时间】:2018-10-19 17:47:12
【问题描述】:
我在 nginx 服务器上的 / 下部署了一个 react 应用程序。我在/old 下部署了一个旧的 Django 应用程序。
如果我打开一个新的浏览器窗口并直接访问/old,我可以毫无问题地访问 Django 应用程序。如果我第一次打开反应应用程序,所有以下对/old 的请求都会重定向到反应应用程序。这只能通过关闭浏览器窗口来清除(选项卡是不够的)。
反应路由器:
function render(location) {
Router.resolve(routes, location)
.then(renderComponent)
.catch((error) => {
console.log(error);
});
}
Nginx 配置:
location /old {
proxy_redirect off;
uwsgi_pass unix:///var/run/uwsgi.sock;
uwsgi_intercept_errors on;
}
location / {
root /var/www;
try_files $uri /index.html;
}
免责声明:我不是 react 应用的开发者,对此知之甚少。我很确定我的 nginx 配置是正确的。相反,我认为这是由于一些重定向缓存/浏览器 foo react 正在做的,但我不知道如何阻止它。
有什么帮助吗?
【问题讨论】:
-
我注意到:注释掉对
registerServiceWorker();的调用,一切正常。不幸的是,我不知道为什么。