Log showed it was redirected successfully, but actually it wasn't?
See original GitHub issueI’m using historyApiFallback with my express server which serves a React-App in the ‘static’ folder. And the express server only provides APIs for the React App.
I just enabled history api fallback
...
app.use(express.static(path.join(__dirname,'static')))
app.use(historyApiFallback({ verbose: true}))
app.use(bodyParser.urlencoded({ extended: true }))
app.use(apiRoutes)
...
something like this.
It’s normal if i request “http://localhost:port”, the React-App is loaded, but it i request something else, the result is shown as the picture above.
how could it happen?
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Login successful but not redirect to another page in reactjs ...
It worked before, but now it doesn't. I thought the error was because I used loadToken () (the route as shown below) but...
Read more >folder redirect syncs only some folders - TechNet - Microsoft
The Event Log shows "folder redirection policy application has been ... "sync completed" but none of his files from the server show up....
Read more >How to follow redirections on a cross origin request with no ...
We'll see that the redirection does occur and the response is in fact from cors . Redirection successful. If we check our server...
Read more >Login Does Not Redirect to Destination URL after Login
Upon successful login, the server does not redirect the page to the destination but instead redirects back to the the user's customised ...
Read more >Tools to Determine What Apache Directive Is Forcing Redirects
Add a rewrite:trace directive to LogLevel. For more details see Apache 2.4 Documentation. Also note: Using a high trace log level for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You need to place the historyApiFallback before the
express.static
handler. Also, the history API fallback only redirects internally, i.e. this is not visible to the user. Does this help?Hi @maximedupre, @bripkens
“http-proxy-middleware” also mutates the same
request.url
property. But in a slightly different way:req.url = req.originalUrl;
(http-proxy-middleware source)This explains the difference in behavior… (basically ignores/overwrites the rewritten url)
Reason for this, is so you can mount is differently in
express
:Feel free to create a ticket if you think this behavior is implemented incorrectly. https://github.com/chimurai/http-proxy-middleware/issues