惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
雷峰网
雷峰网
The Cloudflare Blog
WordPress大学
WordPress大学
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
IT之家
IT之家
V
V2EX
博客园 - 司徒正美
小众软件
小众软件
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Hugging Face - Blog
Hugging Face - Blog
T
Tailwind CSS Blog
Last Week in AI
Last Week in AI
Jina AI
Jina AI
博客园 - 叶小钗
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
阮一峰的网络日志
阮一峰的网络日志
爱范儿
爱范儿

Heroku Dev Center Articles

Migrating from create-react-app-buildpack to Front-End Web CNB | Heroku Dev Center How the Front-End Web Cloud Native Buildpack Works | Heroku Dev Center Deploying Front-End Web Apps on Heroku | Heroku Dev Center Understanding Heroku User Roles and Permissions | Heroku Dev Center Choosing the Right Apache Kafka on Heroku Plan | Heroku Dev Center Provisioning Apache Kafka on Heroku | Heroku Dev Center Managing Topics and Partitions on Apache Kafka on Heroku | Heroku Dev Center Apache Kafka on Heroku Version Support | Heroku Dev Center Changing the Plan of an Apache Kafka on Heroku Cluster | Heroku Dev Center Connecting to an Apache Kafka on Heroku Cluster | Heroku Dev Center Apache Kafka on Heroku Metrics Logs | Heroku Dev Center Heroku GitHub Enterprise Cloud Integration Using GitHub Apps | Heroku Dev Center Heroku Connect for Independent Software Vendors (ISV) | Heroku Dev Center Managed Inference and Agents API with Claude Opus 4.8 | Heroku Dev Center Heroku-26 Stack | Heroku Dev Center Connection Limits on Heroku Postgres Advanced (Limited GA) | Heroku Dev Center Heroku Postgres Advanced (Limited GA) | Heroku Dev Center Migrating to Heroku Postgres Advanced (Limited GA) | Heroku Dev Center Heroku Postgres Advanced Quotas (Limited GA) | Heroku Dev Center Manage Instance Pools on Heroku Postgres Advanced (Limited GA) | Heroku Dev Center Provisioning Heroku Postgres Advanced (Limited GA) | Heroku Dev Center Getting Started with Heroku Postgres Advanced (Limited GA) | Heroku Dev Center Usage and Billing on Heroku Postgres Advanced (Limited GA) | Heroku Dev Center
Migrating from the Nginx Buildpack to Front-End Web CNB |...
2026-09-04 · via Heroku Dev Center Articles

Table of Contents [expand]

  • Additional Reading

Last updated September 03, 2026

The Heroku Front-End Web Cloud Native Buildpack (CNB) is the recommended method for deploying static web apps on Heroku.

Historically, Heroku users implemented an Nginx buildpack (heroku-community/nginx) to deploy static web apps on Heroku, following the Nginx for static sites guide. There are other ways to host a static site as well, including Node.js, Python, Ruby, Go, or any other supported language serving a directory of files over HTTP. Each language has their own unique setup.

Heroku CI doesn’t support CNBs. If an app’s pipeline currently relies on Heroku CI, don’t migrate the app without a plan for how to migrate to a different CI system.

This guide covers how to migrate a static site from Nginx to the Front-End Web CNB.

Create a Branch for Changes

In the app’s Git repo, create a branch to stage these changes:

git checkout -b migrate-to-frontend-web-cnb

Create project.toml

CNB configuration is set with the project.toml file. Based on the contents of the app’s config/nginx.conf.erb, fill out a new project.toml, for example:

[_]
schema-version = "0.2"

[[io.buildpacks.group]]
id = "heroku/static-web-server"

# document root based on nginx "root" entry
[com.heroku.static-web-server]
root = "dist"

# client-side routing based on nginx "error_page 404" directive
[com.heroku.static-web-server.errors.404]
file_path = "index.html"
status = 200

# response headers based on nginx "location" blocks
[com.heroku.static-web-server.headers."/"]
Cache-Control = "max-age=604800, stale-while-revalidate=86400, stale-if-error=86400"

[com.heroku.static-web-server.headers."/*.html"]
Cache-Control = "max-age=604800, stale-while-revalidate=86400, stale-if-error=86400"

[com.heroku.static-web-server.headers."/images/*"]
Cache-Control = "max-age=31536000, immutable"

See all configuration options of the static web server CNB. Not all deeper, custom Nginx configuration is supported. Open an issue on GitHub to request features or report bugs.

Commit the new project.toml to the repo:

git add project.toml -m "Front-end Web CNB project config based on nginx config"
git commit

Update app.json

For apps in pipelines that use Review Apps, you must update app.json. Set the stack to cnb and remove buildpacks:

{
  "stack": "cnb",
  "buildpacks": []
}

Commit the updated app.json to the repo.

Switch to the CNB Stack

To deploy using project.toml and the Front-End Web CNB, you must switch the app’s stack to cnb:

heroku stack:set cnb --app my-web-app

Every instance of an app from development, staging, and production requires setting the cnb stack. When using Heroku Pipelines, the stack gets updated along with promotions between stages.

Test CNB Deployment

Deploy the migrate-to-frontend-web-cnb branch to a non-production version of the app for testing. After the app builds and launches, verify that the app is working correctly.

Release CNB and Cleanup

After verifying with a non-production app, merge the branch, and deploy or promote to the production app.

After release, you can remove the previous Nginx-related files:

git remove config/nginx.conf.erb Procfile -m "Clean-up old nginx config"
git commit

Additional Reading