Bug Description
Referencing Discussion #12604, we independently reproduced the same 500 Internal Server Error when creating websites via API. Additionally, we found that type=static is also affected, not just type=proxy.
Environment
| Item |
Value |
| 1Panel version |
v2.x (community edition, no xpack license) |
| OS |
Ubuntu 24.04 LTS (x86_64) |
| Kernel |
6.8.0-111-generic |
| OpenResty |
1.27.1.2-5-1-focal (container) |
| Access |
Via panel domain (Cloudflare proxy) |
Reproduction
Test 1: type=static
POST https://YOUR_PANEL_DOMAIN/api/v2/websites
{
"primaryDomain": "test-delete-me.example.com",
"alias": "test-delete-me",
"type": "static",
"protocol": "HTTP",
"status": "Running",
"remark": "API test",
"websiteGroupID": 1,
"appType": "new"
}
Result: 500 Internal Server Error — response body is empty (Content-Length: 0).
Test 2: type=static with httpConfig
{
"...": "...",
"httpConfig": {"headers": [], "rewrite": []}
}
Result: Same 500 with empty body.
Verification that API itself works
GET /api/v2/dashboard/base/os -> 200 OK
POST /api/v2/websites/search -> 200 OK (lists 14 existing websites)
POST /api/v2/files (create file) -> 200 OK (returns business error "file already exists")
POST /api/v2/websites/del -> 200 OK (deletes website successfully)
POST /api/v2/websites (create) -> 500 FAIL
Log Analysis
1Panel-Core.log: No error records at all during the 500 response
- OpenResty logs: No 5xx entries for the API requests
- This confirms the transaction is rolled back silently before reaching the response stage
Root Cause
Same as #12604: backend/app/service/website.go CreateWebsite function's switch create.Type statement lacks handlers for constant.Static and constant.Proxy, causing the request to fall into the default branch where nginx config generation fails with empty proxy_pass/path, triggering a silent rollback.
Additional Finding
The original issue only mentions type=proxy. We confirm type=static has the exact same problem, suggesting the issue is broader than a single missing case — it may affect any type not explicitly handled in the switch statement.
Expected Behavior
API should successfully create static and proxy websites, matching the behavior available through the UI.
Bug Description
Referencing Discussion #12604, we independently reproduced the same 500 Internal Server Error when creating websites via API. Additionally, we found that
type=staticis also affected, not justtype=proxy.Environment
Reproduction
Test 1: type=static
Result:
500 Internal Server Error— response body is empty (Content-Length: 0).Test 2: type=static with httpConfig
{ "...": "...", "httpConfig": {"headers": [], "rewrite": []} }Result: Same 500 with empty body.
Verification that API itself works
GET /api/v2/dashboard/base/os-> 200 OKPOST /api/v2/websites/search-> 200 OK (lists 14 existing websites)POST /api/v2/files(create file) -> 200 OK (returns business error "file already exists")POST /api/v2/websites/del-> 200 OK (deletes website successfully)POST /api/v2/websites(create) -> 500 FAILLog Analysis
1Panel-Core.log: No error records at all during the 500 responseRoot Cause
Same as #12604:
backend/app/service/website.goCreateWebsitefunction'sswitch create.Typestatement lacks handlers forconstant.Staticandconstant.Proxy, causing the request to fall into thedefaultbranch where nginx config generation fails with empty proxy_pass/path, triggering a silent rollback.Additional Finding
The original issue only mentions
type=proxy. We confirmtype=statichas the exact same problem, suggesting the issue is broader than a single missing case — it may affect any type not explicitly handled in the switch statement.Expected Behavior
API should successfully create static and proxy websites, matching the behavior available through the UI.