diff --git a/lib/app/components/nuxt.js b/lib/app/components/nuxt.js index 66f15a686d..333762ac4e 100644 --- a/lib/app/components/nuxt.js +++ b/lib/app/components/nuxt.js @@ -8,7 +8,7 @@ export default { props: ['nuxtChildKey'], render(h) { if (this.nuxt._redirected) { - return h('div', [ 'redirecting.' ]) + return h('div', [ '<%= messages.redirect %>' ]) } // If there is some error if (this.nuxt.err) { diff --git a/lib/app/utils.js b/lib/app/utils.js index 297c2df480..f78973d570 100644 --- a/lib/app/utils.js +++ b/lib/app/utils.js @@ -132,7 +132,8 @@ export async function setContext(app, context) { path = status status = 302 } - if (path.charAt(0) === '/' && path.charAt(1) !== '/') { + // "/absolute/route", "./relative/route" or "../relative/route" + if (/(^[.]{1,2}\/)|(^\/(?!\/))/.test(path)) { app.context.next({ path: path, query: query, diff --git a/lib/common/options.js b/lib/common/options.js index 09648b659b..34e7b3e34a 100755 --- a/lib/common/options.js +++ b/lib/common/options.js @@ -323,6 +323,7 @@ Options.defaults = { back_to_home: 'Back to the home page', server_error_details: 'An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.', client_error: 'Error', - client_error_details: 'An error occurred while rendering the page. Check developer tools console for details.' + client_error_details: 'An error occurred while rendering the page. Check developer tools console for details.', + redirect: 'Redirecting to external page.' } } diff --git a/test/basic.ssr.test.js b/test/basic.ssr.test.js index 0ac2f77736..42fca2d4a2 100755 --- a/test/basic.ssr.test.js +++ b/test/basic.ssr.test.js @@ -127,7 +127,7 @@ test('/redirect -> external link', async t => { } }) t.is(headers.Location, 'https://nuxtjs.org') - t.true(html.includes('
redirecting.
')) + t.true(html.includes('
Redirecting to external page.
')) }) test('/special-state -> check window.__NUXT__.test = true', async t => {