javascript - NextJs 重写产生 localhost redirected you too many times 错误
问题描述
以下是我的 next.config.js:
// next.config.js
module.exports = {
async rewrites() {
return [
{
source: '/results',
destination: 'https://mywebsite.com/results',
},
];
},
};
根据 Nextjs 重写文档(https://nextjs.org/docs/api-reference/next.config.js/rewrites#rewriting-to-an-external-url),访问 https://nextjswebsite.com/results,页面内容应改写为https://mywebsite.com/results的内容。
但是,我最终得到“本地主机重定向你太多次”。
任何想法是什么导致错误?
解决方案
所以显然我只需要在目的地有一个尾斜线
// next.config.js
module.exports = {
async rewrites() {
return [
{
source: '/results',
destination: 'https://mywebsite.com/results/',
},
];
},
};
推荐阅读
- elasticsearch - 邮递员中的“mapper_parsing_exception”错误
- windows - 哪个 Windows SDK 是最新的与 Visual Studio 97 和 Windows 9x 兼容
- r - 闪亮的外部传单地图
- android - Firebase Analytics 日志事件甚至一天都无法在仪表板中向我显示自定义捆绑包值
- python - 将代码从 Python 转换为 Julia 后,代码无法正常工作
- c - 分段错误(核心转储)但不知道如何修复
- data-structures - 给定 k 个已排序的数组,从每个数组中选择一个元素,使得所选元素的最大和最小元素之差最小
- sqlite - Sqlite:如何将总数的百分比作为一列
- visual-studio - Visual Studio 2019 Code-Formatter "Ctrl+K / Ctrl +D" 弄乱 HTML 代码
- python - 以上限值为 y 值的增长/动画条形图