Hi everyone,
I’m experimenting a bit with requests and redirects within Express, and I’m new to the framework, so I might be missing something fundamental due to my newness.
In this project Glitch :・゚✧
I have the following code:
app.get("/redirect", function(request,response){
console.log(request.originalURL);
var fullURL = request.get("host") + "/"+ request.originalURL;
console.log(fullURL);
response.set('location', 'https://www.google.com');
response.status(301).send()
});
What I would expect to happen is that request.originalURL
would return /redirect
, but it’s returning undefined
instead.
Is there something I’m missing in order to return the original request’s full URL path?