Reverse proxy

This article only applies to applications installed using nb init.

In NocoBase, the production environment reverse proxy does more than simply forward requests to the application process. Often the details of WebSockets, subpaths, front-end static resources, upload directories, and SPA fallback pages are also handled at the same time.

The function of nb proxy is to collect these easily missed details into a stable set of command entries.

Core process

If you only look at the core process, it is enough to remember these three commands:

nb proxy nginx use docker
nb proxy nginx generate --env test2 --host c.local.nocobase.com
nb proxy nginx reload

If you are using Caddy, just replace nginx in the command with caddy.

If Nginx or Caddy has been installed locally, just change use docker in the first item to use local.

In most scenarios, it is enough to execute use first, then generate, and finally reload. For details on Nginx or Caddy, continue to their respective pages.

When to choose Nginx and when to choose Caddy

It can usually be judged like this:

ScenarioRecommendation
You are already using Nginx to manage your site, certificates, cache or access controlNginx
You already have a domain name and want to run HTTPS as soon as possible and save some TLS details to maintainCaddy

Continue reading below

I want...Where to look
Follow the Nginx management site entranceNginx
Connect HTTPS as soon as possibleCaddy
First adjust the env configuration that will affect the proxy results, such as app-port, app-public-pathnb env update
First confirm the installation and env configuration of the applicationInstall using CLI