Is this ${WEB_PORT} necessary?
I don't quite understand why it's set by default even if my project's code doesn't use it. It seems like I can't remove it either.
Is this ${WEB_PORT} necessary?
I don't quite understand why it's set by default even if my project's code doesn't use it. It seems like I can't remove it either.
Same question, this variable is very strange:
It is auto-generated—implying that:
However:
Conclusion: 100% contradictory in every way.
I hope the official team can provide an explanation! Thank you.
Hello, that's a great question. Let me explain the actual mechanism of WEB_PORT:
WEB_PORT is a "System Variable," not an "Auto-generated value" — these are two different concepts:
| Type | Example | Generation Method |
|---|---|---|
| Auto-generated values | PASSWORD, database USERNAME | Zeabur randomly generates and stores it once when creating the service |
| System/Special Variables | WEB_PORT, ZEABUR_WEB_URL, CONTAINER_HOSTNAME | Zeabur derives it in real-time based on your service settings, it is not a stored random value |
So, it is correct that you see "WEB_PORT is not in the auto-generated variable list" — it does not belong to that category; it belongs to "System Variables," and the relationship is as follows:
${WEB_PORT} = The actual port number of the web port in your service's Networking page
For example, if you set a port ID as web and a port number as 8080 on the Networking page, then ${WEB_PORT} will be expanded to 8080. If you change it to 3000, ${WEB_PORT} will become 3000.
Why does it say "Auto-generated, should not be modified"?
This prompt is indeed a bit ambiguous. What it intends to convey is: "This value is derived from your Networking settings. Please go to the Networking page to change the port number, do not modify the value of this variable directly." Although the UI allows you to change WEB_PORT=xxxx directly in the variable field:
Correct approach:
process.env.PORT (or the equivalent env reading method for your language) in your application code, and inject the system's WEB_PORT using PORT=${WEB_PORT} (many official templates are written this way).WEB_PORT variable itself.For more system variables, please refer to the official documentation: Environment Variables — Special Variables
I hope this clarifies the confusion! If you have any further questions, feel free to reply.
I would like to ask if I need to manually set the WEB_PORT on the Networking page? The reason I ask is that I don't see a port with an ID explicitly labeled as 'web' on the Networking page. Of course, I see a port automatically generated by the system, but it doesn't have any ID identifier, so I can't convince myself to map it to WEB_PORT.
Hello! You don't need to set it manually; the "system-generated port" you see is the web port — ${WEB_PORT} will automatically map to it. Let me explain why:
According to Zeabur's official documentation:
For services deployed from Git repositories, the PORTNAME is always
web.
In other words, for services deployed from Git (GitHub / GitLab, etc.), the automatically generated port has a fixed internal ID of web. Even if the UI doesn't explicitly display "ID: web", it is called web at the underlying level.
Therefore:
${WEB_PORT} → Expands to "the port number of that automatically generated port" (e.g., 8080, 3000, etc.)${ZEABUR_WEB_URL} → Maps to the public URL of this port${ZEABUR_WEB_DOMAIN} → Maps to the domain of this portYou absolutely do not need to add an extra "ID=web" port on the Networking page — it already exists; the UI just doesn't explicitly show the ID field.
Only when you manually add multiple ports (e.g., opening a TCP port for PostgreSQL 5432 or Redis 6379 in addition to web), or when using Marketplace templates (e.g., the PostgreSQL template has multiple built-in ports), will the UI show multiple items, each with its own ID:
| PORTNAME Example | Corresponding Variable |
|---|---|
web | ${WEB_PORT}, ${ZEABUR_WEB_URL} |
database | ${DATABASE_PORT} |
broker | ${BROKER_PORT} |
For your scenario of a single Git web service, the system only generates one port, and the ID is web, so there is no ambiguity.
If you want to be 100% sure, you can add a test variable on the Variables page of your service:
TEST_WEB_PORT=${WEB_PORT}
Then restart the service and run echo $TEST_WEB_PORT inside the container. You will see it expand to the specific port number (e.g., 8080), confirming that ${WEB_PORT} is correctly mapped to that automatic port in Networking.
web${WEB_PORT} will automatically expand to that port numberI hope this clears up your concerns! If you actually encounter a situation where ${WEB_PORT} is not expanding to the expected value (e.g., you cannot connect), please reply and let me know the specific situation so we can investigate further.
This post has been inactive for a while. We will be closing it in 2 days if there is no new activity.
New replies are disabled for resolved issues.