question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Redirect: False Not Affecting Behavior

See original GitHub issue

I started using express as part of Angular Universal and started facing this issue: https://github.com/angular/universal/issues/2827

  1. Request with no trailing slash (/welcome)
  2. A 301 redirect returned to request with location including the trailing slash (/welcome/)
  3. 200 OK returned
  4. Trailing slash stripped in the URL bar in browser

I see other people have brought it up and the answer is usually try redirect: false so that server-static doesn’t add the trailing slash.

Problem is I tried using that using Angular Universal 10.1.1 and Express 4.15.2 and it had no effect.

Does Express / Node have any sort of caching that would cause this change to not show and if so anyone know how to prevent that? Is it working for everyone else still?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dougwilsoncommented, Sep 21, 2022

Hi @ewwwgiddings sorry for your issue. It is certainly possible that something else outside of serve-static is performing the redirect, which is why redirect: false there is having no effect; that answer would only apply if that is were your redirect is coming from. Express.js itself has no caching internally. We can help, but there are too many unknowns and we would need your complete application and reproduction steps in order to debug through it to determine where the redirect originates.

0reactions
ewwwgiddingscommented, Sep 23, 2022

We can close this. I’m working on another way around this and I’m no longer thinking it’s certain to be related to this. Thank you a ton for your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

No session after signin with redirect: false · Issue #1264 - GitHub
Hi there! The point of adding redirect: false is exactly stopping the page from redirecting to anywhere. Since it is the redirect that...
Read more >
event.preventDefault() vs. return false - Stack Overflow
return false from within a jQuery event handler is effectively the same as calling both e.preventDefault and e.stopPropagation on the passed jQuery.
Read more >
Redirections in HTTP - MDN Web Docs - Mozilla
Redirection loops happen when additional redirections follow the one that has already been followed. In other words, there is a loop that will ......
Read more >
Changed behavior in redirects - Netlify Support Forums
Hi all, We're working on making a breaking change in how our redirects feature works regarding file shadowing. We want to explain to...
Read more >
Redirect Loops: Why they harm your SEO performance
Redirect loops often occur as a result of a poor redirect configuration. This can be caused by incorrect redirect rules in your web...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found