explaingit

pi0/nuxt-rewrite

Analysis updated 2026-07-10 · repo last pushed 2023-12-15

4JavaScriptAudience · developerComplexity · 2/5DormantSetup · easy

TLDR

A Nuxt.js module that fixes page breakage caused by server-level URL rewriting, where a browser shows one address but loads content from another internal route. It briefly syncs the router to the real route during render, then restores the visible URL.

Mindmap

mindmap
  root((repo))
    What it does
      Fixes URL rewrite page breaks
      Syncs router during render
      Restores visible URL after
    Tech stack
      JavaScript
      Nuxt.js
      Vue Router
    Use cases
      Reverse proxy setups
      Promotional URLs
      Map old to new addresses
    Audience
      Nuxt developers
      Server config users
    Tradeoffs
      Needs canonical meta-tags
      Server load only
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Fix page loading issues in a Nuxt.js app where a reverse proxy serves content at a different URL than the internal route.

USE CASE 2

Serve promotional content from your main site at a special URL without using a standard redirect.

USE CASE 3

Map an old web address to a new page in a Nuxt.js app while keeping the old URL visible to visitors.

What is it built with?

JavaScriptNuxt.jsVue Router

How does it compare?

pi0/nuxt-rewritearata-ae/purupurupngtubercodextf2/yamldeck
Stars444
LanguageJavaScriptJavaScriptJavaScript
Last pushed2023-12-15
MaintenanceDormant
Setup difficultyeasymoderateeasy
Complexity2/53/52/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Requires an existing Nuxt.js app with server-level URL rewriting already configured, no benefit without a rewrite setup.

In plain English

nuxt-rewrite is a module for Nuxt.js apps that fixes a specific problem caused by URL rewriting. When a server is configured to show users one web address while actually loading content from a different internal route, the page can break during the initial load. This tool prevents that breakage. When a web server rewrites a URL, it serves the content of one page at a different address. This breaks how modern JavaScript frameworks like Nuxt.js load pages on the client side, because the browser's internal router gets confused by the mismatch between the address shown and the content being loaded. This module solves the issue by briefly pretending to the router that the URL is the original internal one, just long enough to render the page. It then quickly reverts the address bar to the rewritten URL the user expects to see. This is for developers building Nuxt.js applications who use server-level rewriting, like setting up a reverse proxy. For example, a team might want to serve content from their main site at a special promotional URL, or map an old address to a new page without setting up a standard redirect. Without this module, doing that at the server level would cause the page to load incorrectly. The README notes a couple of important tradeoffs. First, having multiple addresses lead to the same content is bad for search engine optimization, so developers must use canonical meta-tags to tell search engines which address is the real one. Second, this rewriting only happens during the initial page load from the server. Any links within the app that need rewriting should use standard HTML link tags, which force a new server request, rather than relying on the app's internal navigation.

Copy-paste prompts

Prompt 1
I have a Nuxt.js app behind a reverse proxy that rewrites URLs, causing pages to break on initial load. How do I install and configure nuxt-rewrite to fix the client-side routing mismatch?
Prompt 2
Help me set up canonical meta-tags in my Nuxt.js app alongside nuxt-rewrite so search engines know which URL is the real one when multiple addresses point to the same content.
Prompt 3
Show me how to use standard HTML link tags instead of Nuxt's internal navigation for links that need server-side rewriting, as recommended by nuxt-rewrite.

Frequently asked questions

What is nuxt-rewrite?

A Nuxt.js module that fixes page breakage caused by server-level URL rewriting, where a browser shows one address but loads content from another internal route. It briefly syncs the router to the real route during render, then restores the visible URL.

What language is nuxt-rewrite written in?

Mainly JavaScript. The stack also includes JavaScript, Nuxt.js, Vue Router.

Is nuxt-rewrite actively maintained?

Dormant — no commits in 2+ years (last push 2023-12-15).

How hard is nuxt-rewrite to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is nuxt-rewrite for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.