Skip to content

Gateway Management ​

Updated: 11/17/26, 11:11:35 AM

The gateway (nginx) is the single entry point of the whole deployment: except for the gateway, containers publish no ports to the host by default, and all external traffic is distributed and proxied by the gateway by domain. This page covers domain binding, CDN fronting, origin-pull tokens, external endpoint exposure, and MQTT access; per-service port exposure levels (off / local / public) are covered in Configuration and Troubleshooting - Port Exposure.

Domain Binding and CDN Fronting ​

The gateway supports the following binding targets:

TargetPurpose
ui-adminAdmin portal
ui-merchantMerchant portal
h5H5 app
app-h5-adminAdmin mobile H5 site (bindable only after it is enabled in "Mobile Management")
app-h5-merchantMerchant mobile H5 site (bindable only after it is enabled in "Mobile Management")
backendBackend API
appMobile API (dedicated entry for mini programs / apps)
artemisArtemis console
mqttMQTT access domain (device/terminal message channel; bound on the MQTT Access tab)
mockMock gateway (provided in demo mode only)

Enter bare domains only — no protocol, no path.

The Mobile API domain is a dedicated entry for mini programs and apps: once bound, it always admits the mini-program/app session API family plus the cashier open API (/unipay), regardless of the "External Endpoints" toggles; without it, mini programs and apps reach the backend through the backend API domain, governed by the "Mini program / APP API" toggle under External Endpoints. The HTTPS prerequisite is the same as the backend domain — the outer CDN / gateway layer must serve HTTPS, since WeChat / Alipay mini programs only accept HTTPS endpoints. To use it, enter this domain as the API base URL when building a mini program on the panel's "Mobile Management" page (leave it empty to keep the backend API domain default).

Access Modes ​

The gateway origin carries no certificates and always listens for origin-pull traffic over HTTP on port 80; HTTPS is terminated uniformly by the outer CDN / gateway layer (certificate issuance, renewal, and validation all happen in the outer console). There are two access modes:

ModeBehaviorFits
Direct to origin (default)The domain resolves straight to the server; the gateway does not check the request originNo CDN, intranet, or temporary integration
Via CDN / outer gateway origin-pullEach bound-domain entry only lets through requests carrying the correct origin-pull token; everything else gets 404Production, domain already on a CDN

CDN Onboarding Checklist ​

After switching to "Via CDN / outer gateway origin-pull", follow the checklist shown on the panel's "CDN Fronting" page:

  1. Configure HTTPS certificates for each bound domain in the CDN console (free certificates are fine);
  2. Choose HTTP as the origin-pull protocol and set the origin-pull port to the gateway listening port (default 80);
  3. Point domain resolution at the CNAME assigned by the CDN;
  4. If the CDN provider publishes its origin-pull ranges (Alibaba Cloud / Tencent Cloud, etc.), allow only those ranges on port 80 in the cloud security group (cloud-side operation), layering it on top of the origin-pull token.

Configure the origin-pull header before switching

After you switch to CDN origin-pull mode and apply the gateway, domain access that resolves directly to this server is rejected with 404 until the origin-pull header is configured in the CDN console — this is the intended protection. The panel asks for confirmation when switching.

Origin-Pull Token ​

With CDN origin-pull mode enabled, the panel generates an origin-pull token. Configure it in the CDN console as the value of the custom origin-pull header X-Daxpay-Origin: each bound-domain entry only lets through requests carrying the correct token, preventing forged Host requests from bypassing the CDN straight to the origin.

  • Only bound-domain entries take part in the check: direct entries for merchant APIs and channel callbacks do not validate the token (callback servers do not send custom headers, so they must be allowed through);
  • after regenerating the token you must click "Apply Gateway Configuration" for it to take effect; the old token stops working immediately, and the CDN console header must be updated in sync — otherwise CDN origin-pull requests get 404 and the site goes down at once;
  • when a backend API domain is bound, that domain must CNAME to the CDN and carry the origin-pull header, or WeChat / Alipay and other channel callbacks cannot reach the origin;
  • the Artemis console domain should not go through a CDN (most CDNs support WebSocket poorly and the console's live views may misbehave) — keep it intranet-only or manage it through an SSH tunnel.

After saving domains, access modes, and endpoint toggles, click "Apply Gateway Configuration" to render the nginx configuration and reload it into effect.

External Endpoints ​

The gateway admits external requests by path prefix under "Gateway Management → External Endpoints"; anything not admitted is rejected. Default state of each endpoint group:

Endpoint groupPurposeDefault
/unipayMerchant open APIOn
/unipay/callbackChannel callbacksOn
/app-*Mini program / APP API: session APIs for the admin / merchant mini programs and appsOn
/client/Open Access Interfaces: anonymous or signed endpoints for external clients without their own frontend container (receiving devices / terminals, etc.) that connect straight to the gateway (turning it off breaks QR code payment and device terminal access)On
/elfDesktop payment assistant (Payment Elf): endpoints the desktop client connects to directlyOn
/epayEPay-compatible APIOff

Mini program / APP API covers the whole set of backend endpoints a mini program or app needs to sign in and run (login, notices, dictionaries, file upload, etc.) and only applies to the backend API domain line. There are three access routes; the status line at the bottom of the toggle card always shows the one currently in effect:

  • Compatible route (default): leave the API base URL empty when building a mini program (the backend API domain is used); with the toggle on, sign-in works out of the box;
  • Dedicated route: a Mobile API domain is bound and entered as the API base URL at build time — always open, unaffected by this toggle; after every deployed client has switched over, turning the toggle off is recommended so sign-in endpoints are only exposed via the dedicated domain;
  • Broken route: with the toggle off and no Mobile API domain bound, mini programs and apps cannot sign in — the panel asks for confirmation before you turn the toggle off.

When accessing directly by IP, this endpoint group always returns 404 (protecting sign-in endpoints from brute force, same stance as the permanent /admin block), regardless of any toggle.

Management and debug paths such as /admin/, /mch/, /demo/, /test/, /swagger-ui/ stay blocked. Before going live, review the endpoint toggles, and restrict sources with domains, gateway rules, and a firewall.

MQTT Access ​

The "Gateway Management → MQTT Access" tab serves the device/terminal message channel — a persistent-connection pipeline shared by voice broadcast, cloud printing, and future device features; its main consumer today is Voice Broadcast (Virtual Device). The page has four parts:

Artemis Access Status ​

The status card checks the message broker's access configuration item by item (61614 access port, core-port narrowing, device address policy, permission matrix, access account); "One-Click Apply" lets the panel fill in whatever is missing and create the access account — idempotent and repeatable, already-configured items are skipped. The operation runs as an asynchronous task; follow its progress and result in the Task Center, and expect an Artemis container restart along the way.

Access Domain ​

  • Enter the bare domain only (e.g. mqtt.example.com); the terminal access address is wss://<that-domain> — no port or path;
  • HTTPS is terminated by the outer layer (outer gateway / load balancer / CDN); configure the certificate in the outer console;
  • This entry is exempt from the origin-pull token check (MQTT clients do not send custom origin-pull headers); protection relies on the broker access account (subscribe-only, no publishing);
  • Should not sit behind most CDNs: connected terminals depend on persistent long connections, and most CDNs handle them poorly (short timeouts, outright disconnects) — devices drop and reconnect constantly and miss messages (missed broadcasts / missed prints). Point the domain directly at the origin IP, or terminate TLS on an outer gateway / load balancer that supports WebSocket long connections.

Connection Capacity ​

The maximum connections per nginx worker process (worker_connections, default 4096). Each connected terminal holds 1 persistent connection; raise it when you run hundreds of devices or high API concurrency. Changes take effect via "Apply Gateway Configuration" (the gateway container is rebuilt automatically; all connections drop briefly).

Access Credentials ​

The access account defaults to app-device and supports customization and renaming: the "Modify Access Credentials" dialog changes the account and the password together; the password can be revealed and copied here. The daxpay.device. shown here is the broker core address prefix (used for ACL / address-setting matching); the terminal actually subscribes to the slash topic daxpay/device/audio/{deviceNo} (delivered by the activation API and used as-is by the APP). The account can only subscribe to device topics — publishing is forbidden (prevents forged pushes). The panel automatically syncs the admin panel "Platform Configuration → MQTT Access" configuration (access URL included); after renaming or changing the access domain, re-sync with one click — only self-hosted Artemis (not deployed through the panel) needs to be filled in on the admin panel manually. The credentials are delivered to terminals upon device activation.

"Modify Access Credentials" and "Re-Sync" also run as asynchronous tasks: the task starts in the Task Center on submit, its progress and result live in the task log, and changes take effect only when it finishes; credential changes restart the Artemis container and finish with a live verification, briefly interrupting the message channel.

For the full deployment and usage flow see Voice Broadcast (Virtual Device): Deploy & Use.