Every line of 'express redirect' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
17 function redirect (req, res) { 18 const path = req.params.path || '' 19 const url = config.settingsUrl + (path ? '/' + path : '') 20 res.redirect(url) 21 }
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
6 redirect(req, res) { 7 res.redirect("/test/redirectTo"); 8 }
78 redirect(url = '/', options = {}) { 79 this._response.redirect(url, options.httpStatus || 302); 80 }
24 function redirect(res, location) { 25 res.end(getHeader(302, 'Location: ' + location + '\r\n')); 26 }
18 router.get(/^\/signup\/$/, function redirect(req, res) { 19 /*jslint unparam:true*/ 20 res.set({'Cache-Control': 'public, max-age=' + utils.ONE_YEAR_S}); 21 res.redirect(301, subdir + '/ghost/signup/'); 22 });
38 function redirect(res, location, extra_headers) { 39 const headers = { 40 Location: location, 41 'Content-Type': 'text/plain', 42 }; 43 if (extra_headers) { 44 Object.assign(headers, extra_headers); 45 } 46 47 res.writeHead(302, headers); 48 res.end('Redirect to ' + location); 49 }
1 function Redirect(url, code) { 2 this.url = url; 3 this.code = code || 302; 4 }
104 function redirectWithError(res, error = 'internal_server_error') { 105 const urlParams = qs.stringify({ error }); 106 res.redirect(`${URL_FRONTEND}/?${urlParams}`); 107 }
52 function initRedirect (ctx) { 53 return function redirect (location) { 54 if (!!ctx.res) { 55 ctx.res.writeHead(302, { Location: location }) 56 ctx.res.end() 57 } else { 58 window.location.replace(location) 59 } 60 } 61 }
37 function redirect(redirectUrl) { 38 try { window.location.replace(redirectUrl); } 39 catch(e) { window.location = redirectUrl; } 40 }