It's 2026, the Vue project uses history routing, but refreshing a subpage still returns 404. Ops says the fallback rule was added long ago—is it on the wrong layer?
A Vue project uses history routing. After going live, refreshing a subpage returns 404. Most of the time this is not a frontend code error; the server is not falling back unknown paths to index.html: when the browser directly requests /order/123, that file really does not exist on the server, and returning 404 is its normal response. The check is straightforward—pick a child route and refresh it directly. If it returns the site homepage HTML with status 200, the fallback is in effect; if it returns 404 or the server default page, you need to add a rewrite on the server. Who should act depends on one line: if server configuration can be changed, ops or backend implements it, and frontend delivers the rule and acceptance URLs with the package; for pure static hosting where it cannot be changed, check whether the platform has an SPA fallback switch, and if not, fall back to hash. In 2026 deliveries, most of these situations that require repeated confirmation of responsibility are not technically difficult; both sides simply only accepted the homepage.
Root cause of refresh 404: who ultimately interprets the path
It is enough to distinguish two ways of entry. When a user clicks a link on the homepage to go to /order/123, the frontend router changes the address bar with pushState; the browser does not actually send a request, so everything works. When the user refreshes, opens from bookmarks, or clicks in from WeChat or email, the browser really requests /order/123. This happens before Vue loads, and the frontend has no chance to intervene. The premise for history routing to work is that the server falls back all nonexistent page paths to index.html, while static assets and API paths are still returned as usual.
So responsibility is not ambiguous: whether server configuration can be changed is the dividing line. For self-hosted nginx, Node services, or cloud servers, ops or backend adds a rule; some object storage and website builders only offer an 'SPA fallback' switch, and without it you can only use hash. A common situation in 2026 is that frontend assumes ops will configure it, ops assumes frontend used hash, and both sides have only clicked the homepage.
To decide who acts, clarify three things first
- Who can change the server: is it nginx, a gateway, or CDN edge configuration, and are you changing the layer that actually takes effect? Changing only one machine usually does not help.
- Is there a cache layer in between: if the entry HTML is cached long-term by a CDN, users still get old references even after the rule is configured.
- Is it deployed in a subdirectory: the router base and the bundled asset prefix must be paired. Missing one looks like a blank screen, but it is unrelated to server fallback.
These three questions can be answered during planning, and the answers directly determine which routing mode to use. That is much cheaper than trial and error on launch day. When ops says the rule was added long ago but 404 persists, it usually falls under the first or second item.
Do not mix up blank screens, 404s, and missing styles when troubleshooting
The symptoms look similar, but the fixes are completely different. In projects, I usually work down through the request layer, routing layer, and asset layer, because these three correspond to whether the file came back, whether the route matched, and whether assets took the wrong path.
- Request layer: open the child route in developer tools or with curl, and check the status code and content-type. Only when it returns 200, is text/html, and the entry script is visible in the body is the fallback in effect.
- Routing layer: if fallback is in effect but you cannot enter the target page, it is often a guard redirecting back to the homepage during authentication, or a mismatch between base and the deployment directory. The symptom is that the address bar stays on the child route while the content is the homepage.
- Asset layer: if the shell appears but all styles are gone and the console is full of 404s, first check whether the error paths are missing the subdirectory prefix.
The value of the three-stage method is that it gives a troubleshooting order: confirm the server first, then touch frontend code. If you change routing first, a common outcome is spending a long time only to find that the request never went back to index.html at all.
Hash or history: a few aspects are enough to decide
This is not an aesthetic issue; it is a trade-off between cost and benefit. The checkable differences are roughly: hash needs no server cooperation, and migration cost is close to zero. The price is a # in the address, and some share panels truncate everything after #. History gives clean links that are easier to share and measure, but it moves complexity to the server and requires a fallback rule.
- Crawling and SEO: neither solves whether content depends on JS rendering. To let search engines reliably get the body text, you still need prerendering or SSR; history only makes URLs cleaner.
- Subdirectory deployment: history requires aligning both base and the fallback rule, so there are more failure points; hash mainly deals with the asset prefix.
- Migration timeline (experience range): for an existing project switching from hash to history, configuration and integration testing typically take 0.5–1 working day; when cross-team coordination and cache-layer changes are involved, 1–3 working days is typical; adding prerendering must be estimated separately.
To put the conclusion directly: for admin backends, intranet systems, and pure static hosting where configuration cannot be changed, hash is less trouble; only official websites and content sites facing external users that need clean links and share measurement are worth paying the server-side cost for history.
On delivery: constraints are often not in the code
A common situation is that the frontend runs fine locally, and only at delivery do you find that the client only provides an object storage directory and a console account, with no visibility into nginx and no ability to touch the gateway. Going back to change the routing mode at that point is costly: route code must be adjusted, historical analytics data containing # must be recalculated, and promotional short links already distributed must be regenerated. Typical rework range is 1–3 days; if campaigns are already live, scheduling must be arranged separately.
So in enterprise project delivery, a safer approach is to clarify the three questions above during project planning, write them into the proposal, and use them as the basis for choosing the mode, rather than testing on launch day. Acceptance criteria should also be agreed in advance; do not use 'it looks like it opens' as the standard: a random child route refreshed directly returns 200 with correct content; two- or three-level deep paths also work; after refresh, all js and css return 200; nonexistent paths go to a custom 404 page; addresses with query strings and anchors keep their parameters after refresh.
When it applies and when it does not
History is suitable for: official websites, content pages, and product detail pages facing external users that need clean, shareable links; projects with a controllable server, or a platform that clearly provides SPA fallback; and projects planning to add prerendering or SSR later, where unifying the URL format earlier saves more trouble.
There is no need to force it for: pure intranet backends and systems mainly used for post-login operations, where whether the URL looks good almost does not affect usage; and projects that can only use static hosting without custom fallback and do not plan to change platforms in the short term—forcing history only pushes the problem to every release. Whether server configuration can be changed takes priority over whether the URL looks good.
Common questions
Refreshing works in local development, but after building and going live, refreshing returns 404. Is the build configuration wrong?
Most likely not. The development server has history fallback built in. Whether it works online depends on whether the server has the same rule, so first check the status code and response type at the request layer.
I can only log in to a static hosting console and cannot change nginx. Can I still use history?
Check whether the platform has an SPA fallback or rewrite switch. If it does, you can use it; if not, forcing it is not recommended. The cost of switching back to hash is usually lower than changing platforms and regenerating links.
The fallback is configured, and the subpage returns 200 but the page is blank. Do I still need to ask ops?
Generally no. The fallback is in effect, so the problem is in the frontend: first check whether the console error paths are missing the subdirectory prefix, then verify that the router base and bundled asset prefix are paired.
For indexing, is history much better than hash?
The help is limited. It makes URLs cleaner and easier to share and schedule for crawling, but whether the body text gets indexed depends on whether the content is in the first-screen HTML. For single-page projects, prerendering matters more.
Next step: add 'directly refresh a random child route' to the launch acceptance checklist, and deliver the fallback rule and configuration screenshots with the package during handover. If server permissions are not in your hands, confirm this item during planning before deciding hash or history. The above standards apply to conventional Vue single-page projects; server routing rules for SSR, prerendering, and hybrid multi-page architectures must be agreed separately.
-
If an API occasionally returns null and a product card prints “null,” should the fallback live in data fetching or rendering?
Date: Nov 22, 2026 Read: 8
-
In admin lists, when a product name gets long, the Edit/Unpublish button is pushed off screen—should the ellipsis go on the title or the outer container?
Date: Nov 21, 2026 Read: 8
-
In 2026, AI-generated pages work fine on the normal path, but what happens when the network drops, users click repeatedly, or they hit back? Are these edge states the frontend team's job?
Date: Nov 20, 2026 Read: 18
-
In 2026, product says only “make it a bit smoother” before a project starts—then brings up experience before launch. Who should kick off the experience target sheet?
Date: Nov 19, 2026 Read: 12
-
A coupon pop-up is still open in WeChat, but pressing Back on the phone exits the whole campaign page—who should own the Back button?
Date: Nov 18, 2026 Read: 20




