
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@progfay/nextjs-ssg-rewrite-rule-gen
Advanced tools
generate nginx rewrite rules for Next.js SSG (Pages Router)
@progfay/nextjs-ssg-rewrite-rule-genNext.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 RegExpdirectives: 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 475 weekly downloads. As such, @progfay/nextjs-ssg-rewrite-rule-gen popularity was classified as not 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
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.