Comments (7)
Interesting issue. You can start debugging this issue by enabling logging via the verbose
option:
history({
verbose: true
})
This will print redirect reasons to the console.
from connect-history-api-fallback.
Thanks @bripkens. I did try this and this is the relevant line that I get:
Rewriting GET /practice/1 to /index.html
Not sure where to go from there, however..
from connect-history-api-fallback.
This is the correct behavior for the history API fallback. See the following section from the README.
- The request is a GET request
- which accepts text/html,
- is not a direct file request, i.e. the requested path does not contain a . (DOT) character and
- does not match a pattern provided in options.rewrites (see options below)
from connect-history-api-fallback.
Right, that makes sense.
What I'm wondering is, given this behavior, why /practice
is preserved but /practice/1
is not. Is there anything I can do with this library to preserve the rest of the path? Or, if this concern has nothing to do with this library, I'd still love to be pointed in the right direction if you have any ideas.
It seems strange to me that being unable to directly access any path beyond one level deep would be expected behavior, which makes me think I must be missing something.
from connect-history-api-fallback.
So, I took a look at my S3 rewrite rules as I'm getting the desired behavior there.
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>403</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<HostName>practice-staging.pollinate.life</HostName>
<ReplaceKeyPrefixWith>#/</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>
So I'm realizing that what I'm asking for is that I would like /practice/1
to redirect to /#/practice/1
.
Is that out of the scope of this library or is there configuration I can pass to get that same behavior?
from connect-history-api-fallback.
I'm going to close this out, on investigating this further I don't think it has probably has much to do with this middleware. I figured out the correct rewrite rule, but it's still not working. Probably something with my setup. Thanks!
from connect-history-api-fallback.
Sure enough, this was some routing code I had in my Angular app. Sorry about that.
from connect-history-api-fallback.
Related Issues (20)
- URL with ending slash. HOT 1
- Problem with static assets
- Normalize rewrites HOT 5
- dont't fallback to index page if browser doesn't want html HOT 7
- Doesn't work when a route is reloaded HOT 1
- What if the index.html is not in the root directory,such as it's in the src directory? HOT 1
- Is there a way only fallback to index.html when 404 (not exist file)
- mistakenly rewriting non extension files as extensioned files HOT 5
- HEAD requests are not accepted HOT 3
- hisotryApiFallback rewrites don't work HOT 1
- Dynamic content in index.html HOT 3
- Dealing with trailing slashes
- GET request does not go through while other requests do like POST AND PUT etc... HOT 1
- disableDotRule causes png, jpeg files to rewrite to index.html
- js file not found when subdirectory visited directly HOT 2
- Should History API fallback use HTTP content negotiation?
- Audit vulnerabilities detected in the connecthistoryapifallback project on Tag: v1.6.0
- Running code from another path causes history api not to work HOT 2
- Is there any KOA middleware HOT 1
- Hh
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connect-history-api-fallback.