
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
@progfay/nextjs-ssg-rewrite-rule-gen
Advanced tools
generate nginx rewrite rules for Next.js SSG (Pages Router)
@progfay/nextjs-ssg-rewrite-rule-gen
Next.js supports Static Exports.
However, it's a lot of work to manage the routing for the generated file without Vercel. Dynamic Routes feature makes routing more difficult.
This application automatically generates nginx rewrite rules for generated files.
npm install -D @progfay/nextjs-ssg-rewrite-rule-gen
[!NOTE] This application is available with zero configuration.
You can run this application with config in following command: nextjs-ssg-rewrite-rule-gen --config config.json
{
"pagesDirPath": "apps/src/pages",
"ignoreRoutes": ["/debug"],
"nginxConfigs": [
{
"pattern": "^/credential$",
"directives": ["add_header Cache-Control \"no-store\";"]
}
],
"basePath": "/app",
"trailingSlash": true
}
Available configs:
pagesDirPath
: customize path for pages
directoryignoreRoutes
: exclude specific paths from outputsnginxConfigs
: customize configuration inside of nginx location
directive
pattern
: pattern string of RegExp
directives
: additional nginx directivesbasePath
: next.config.js Options: basePath | Next.jstrailingSlash
: next.config.js Options: trailingSlash | Next.jspages
directory:
pages
āāā user
āāā [id]
āāā index.js
āāā new
āāā index.js
ā
Generated files with Static Exports (next build
and output: "export"
):
out
āāā user
āāā [id].html
āāā new.html
ā
nginx rewrite rules (generated by @progfay/nextjs-ssg-rewrite-rule-gen
):
location ~ ^/user/new/?$ {
rewrite ^/user/new/?$ /user/new.html break;
}
location ~ ^/user/[^/]+?/?$ {
rewrite ^/user/[^/]+?/?$ /user/[id].html break;
}
FAQs
generate nginx rewrite rules for Next.js SSG (Pages Router)
The npm package @progfay/nextjs-ssg-rewrite-rule-gen receives a total of 2,131 weekly downloads. As such, @progfay/nextjs-ssg-rewrite-rule-gen popularity was classified as popular.
We found that @progfay/nextjs-ssg-rewrite-rule-gen demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Ā It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.