The previous article completed the setup of the ZgoCloud Playground execution node.
The new execution interfaces are ready:
https://play.go-dev.shuijingwanwq.com:8443/compile
https://play.go-dev.shuijingwanwq.com:8443/fmt
They are statically forwarded to the official Go Playground:
https://play.golang.org/compile
https://play.golang.org/fmt
However, reaching this step only solves the problem of “the new execution node is now working.”
In the production environment, the A Tour of Go browser code still uses the original same-origin interfaces:
/_/compile
/_/fmt
In other words, the actual request path is still:
Browser
→ EdgeOne
→ Alibaba Cloud
→ Go Tour
→ go.dev Playground
This article continues to document the second phase:
How to actually switch Run and Format in the production environment to the new ZgoCloud execution node, and why, after deployment, the browser temporarily continued executing the old logic even though the new version had been successfully deployed.
1. First, confirm exactly how the production environment executes code
Before making any formal changes, I had Codex perform a read-only audit on go-tour-i18n.
Rather than rushing to modify the code, this round focused on thoroughly mapping out the request paths for Run, Format, local preview, and production.
The results were slightly more complex than initially imagined.
Run in the production environment uses:
HTTPTransport
Ultimately initiated by _content/js/playground.js:
POST /_/compile?backend=...
However, Format does not entirely use the same HTTPTransport.
There are actually two places in the repository that make Format requests:
_content/js/playground.js
_content/tour/static/js/services.js
They both ultimately request:
/_/fmt
Therefore, if only Run is modified, it easily leads to:
Run → new execution node
Format → still requests the old interface
This kind of half-migrated state.
2. Local preview and production cannot be modified together
The audit also confirmed a very important distinction.
Local preview uses:
SocketTransport
Via:
/socket
To connect to the local runtime environment.
While production uses:
HTTPTransport
And the production environment has explicitly disabled:
/socket
/socket/
Both of these paths return in production:
404
So this change cannot simply globally replace all:
/_/compile
/_/fmt
With external URLs.
What I want to ultimately achieve is:
Production:
Run → ZgoCloud /compile
Format → ZgoCloud /fmt
Local preview:
Continue using SocketTransport
While preserving the original relative path behavior, leaving room for compatibility and rollback.
3. Add a unified Playground base URL
The final approach adopted is to add a unified configuration during page initialization:
window.playgroundBaseURL
Production injects:
https://play.go-dev.shuijingwanwq.com:8443
While local preview keeps:
""
Which is an empty string.
Then, a very small URL handling function was added.
The logic is roughly:
If playgroundBaseURL is empty:
Keep the original path
If playgroundBaseURL is configured:
Use the external base URL
This way, the original calls can still be written as:
/_/compile
/_/fmt
But in the production environment, they will ultimately generate:
https://play.go-dev.shuijingwanwq.com:8443/compile
https://play.go-dev.shuijingwanwq.com:8443/fmt
And when no external base URL is configured, they remain:
/_/compile
/_/fmt
4. Why the external interface no longer uses /_/
A small adjustment was made here midway through.
Initially, to maximize compatibility with the original A Tour of Go request paths, ZgoCloud was also temporarily designed to use:
/_/compile
/_/fmt
Later, I re-examined the official interfaces:
go.dev
→ /_/compile
→ /_/fmt
While the direct Playground interfaces are actually:
play.golang.org/compile
play.golang.org/fmt
Therefore, there was no need for the new standalone execution service to continue inheriting the /_/ path layer.
The final external interfaces were unified to:
/compile
/fmt
This makes the entire structure more direct:
play.go-dev.shuijingwanwq.com:8443/compile
→ play.golang.org/compile
And:
play.go-dev.shuijingwanwq.com:8443/fmt
→ play.golang.org/fmt
The old same-origin interfaces remain:
/_/compile
/_/fmt
The responsibilities of the two sets of interfaces are thus easier to distinguish.
5. Run and both Format locations must be switched together
After the modifications were completed, all three request locations in the production environment use the same base URL rule.
Run:
https://play.go-dev.shuijingwanwq.com:8443/compile?backend=...
Format in the Playground editor:
https://play.go-dev.shuijingwanwq.com:8443/fmt?backend=...
Format in the course page service:
https://play.go-dev.shuijingwanwq.com:8443/fmt
Here:
backend
Is still just a normal query parameter.
It does not participate in the selection of:
scheme
host
port
Therefore, this parameter cannot be used to change the request target.
6. The production base URL must also consider JavaScript string safety
This round also addressed a very easily overlooked issue.
The production base URL will ultimately end up in:
window.playgroundBaseURL = ...
So the configuration cannot simply be injected into JavaScript using string concatenation.
Ultimately, Go’s:
encoding/json.Marshal
Was used to generate a JSON string literal that is safe for JavaScript to use.
During testing, special values like the following were specifically used for validation:
https://example.test/";alert(1)//</script>
json.Marshal correctly handles:
"
\
<
>
&
And other such characters.
For example:
<
→ \u003c
>
→ \u003e
Midway through, a test failed because the hand-written escape expectations missed the > for:
\u003e
Ultimately, it was confirmed that the implementation itself had no issues; only the test was fixed to validate directly against the actual output of json.Marshal.
7. The old server-side Playground interfaces have not been deleted yet
Although the production browser is now ready to access ZgoCloud directly, I did not immediately delete the original ones in the Alibaba Cloud Go Tour:
/_/compile
/_/fmt
They are still retained for:
Browser or other compatible requests
→ Alibaba Cloud Go Tour
→ go.dev
This is no longer the main path for normal production Run / Format, but serves temporarily as:
Compatibility
Rollback
Capabilities.
The focus of this migration is:
First, stabilize and deploy the new browser execution path, and then consider whether to remove the old implementation later.
This way, if unexpected issues occur after the new path goes live, there is still a relatively simple path to recovery.
8. Only commit after all tests pass
This round ultimately modified 9 files:
_content/js/playground.js
_content/tour/static/js/page.js
_content/tour/static/js/services.js
internal/tour/appengine.go
internal/tour/local.go
internal/tour/production.go
internal/tour/production_test.go
internal/tour/server_test.go
internal/tour/tour.go
Tests included:
Production injects the correct Playground base URL
Local preview does not inject the production URL
Production continues to use HTTPTransport
Local continues to use SocketTransport
Production /socket continues to return 404
Run ultimately generates ZgoCloud /compile
Both Format locations ultimately use ZgoCloud /fmt
When the base URL is empty, /_/compile and /_/fmt are still preserved
backend cannot change the request host
JavaScript string safety escaping
Finally:
go test ./internal/tour
Passed.
Full:
go test ./...
Also all passed.
Committed as:
ffbb8ce
feat: production browser directly connects to Playground proxy
9. The release manifest must also be updated synchronously
After the code switch was completed, I found a leftover issue at the release level.
release.json still recorded:
{
"execution_transport": "http-playground-proxy",
"execution_provider": "go.dev"
}
Normal execution has now ultimately fallen to:
play.golang.org
So:
execution_provider
Can no longer be written as:
go.dev
Finally adjusted to:
{
"execution_transport": "http-playground-proxy",
"execution_provider": "play.golang.org",
"local_socket_enabled": false
}
Here:
execution_transport = http-playground-proxy
Is still retained.
Because the browser still uses HTTPTransport and calls the official execution service via the fixed Playground forwarding node.
At the same time, it was also necessary to modify:
scripts/deploy-production.sh
Because the deployment script previously also validated:
execution_provider = go.dev
If only the manifest is changed without updating the deployment pre-check, the new release would be rejected by its own production deployment script.
This round synchronously modified:
publish.go
publish_test.go
deploy-production.sh
README.md
PROJECT_STATE.md
And completed full testing once again.
10. Generate the new production bundle
The final production bundle is:
/tmp/go-tour-release-20260813-zh-CN-1fe73f5
Corresponding project commit:
1fe73f54615b3d05d09133f6e25aa91c5fb07f75
Release status:
ready=103
pending=0
blocked=0
pages=103
articles=7
release.json has correctly recorded:
{
"execution_transport": "http-playground-proxy",
"execution_provider": "play.golang.org",
"local_socket_enabled": false
}
All bundle files have been re-verified with SHA-256 checksums.
The production binary remains:
Linux amd64
Statically linked
CGO_ENABLED=0
11. Automatic deployment succeeded
The new release was then officially deployed via the existing automated deployment script.
Final production directory:
/data/go-tour/releases/20260813-zh-CN-1fe73f5
Deployment process completed:
Local bundle pre-check
Remote upload
Remote SHA-256 verification
Permission normalization
Atomic current switch
go-tour.service restart
localhost health check
Public domain acceptance
During the first health check right after the service restarted, it showed:
service=active
HTTP=000
Subsequently:
active + HTTP 200
active + HTTP 200
active + HTTP 200
After passing three consecutive times, the deployment was officially deemed successful.
Finally:
deployment completed
public acceptance passed
At this point, from the server side, the new release had successfully gone live.
But the truly interesting problem had just emerged.
12. The new release is live, so why is the browser still requesting the old interface?
I then opened Firefox and navigated to:
https://go-dev.shuijingwanwq.com/tour/welcome/1
Opened the Developer Tools Network panel, and then clicked “Run”.
The page output normally:
Hello, 世界
Program exited.
But the request shown in the Network panel was still:
POST https://go-dev.shuijingwanwq.com/_/compile?backend=

/_/compileThis was very strange.
Because:
- The new code had been committed;
- The new production bundle had been regenerated;
currenthad been switched;go-tour.servicehad been restarted;- The public web page was returning 200.
Looking only at the deployment results, it would be easy to keep suspecting:
Did the production binary not update?
Was the JS not included in the bundle?
Did the initScript injection fail?
But the real cause was not in the Go Tour.
13. The real issue was that EdgeOne cached the old /tour/script.js
The browser execution logic for A Tour of Go ultimately comes from:
/tour/script.js
Although the new production release had been switched, the EdgeOne nodes might still be holding a previous version of this script.
So the browser was getting:
Old HTML / New service
+
Old script.js
The old JavaScript naturally still executed:
/_/compile
/_/fmt
After finally confirming the issue, I did not flush the entire site cache, but only targeted:
https://go-dev.shuijingwanwq.com/tour/script.js
For a targeted cache purge.

/tour/script.js in EdgeOneThis is well worth remembering going forward:
A successful production release switch does not mean the browser is necessarily executing the new front-end code.
As long as the CDN retains old dynamic script resources, the behavior the browser sees may still belong to the previous version.
14. After refreshing /tour/script.js, the new execution path took effect immediately
After the targeted EdgeOne cache purge, I reloaded the course page.
Clicked “Run” again.
This time, the Firefox Network panel showed:
POST https://play.go-dev.shuijingwanwq.com:8443/compile?backend=
Status:
HTTP 200
Protocol:
HTTP/2
The page output was still normal:
Hello, 世界
Program exited.

/tour/script.js cache, Run directly requests ZgoCloud /compile and returns HTTP 200The CORS in the response was also as expected:
access-control-allow-origin:
https://go-dev.shuijingwanwq.com
At this moment, it was finally possible to confirm:
The production browser Run no longer goes through the Alibaba Cloud Go Tour’s
/_/compile.
15. Format has also completed the real browser switch
After Run passed, I continued to test “Format”.
The actual Format request had changed to:
https://play.go-dev.shuijingwanwq.com:8443/fmt
It also returned successfully.
Therefore, the final two normal production execution paths are respectively:
Run
Browser
→ ZgoCloud /compile
→ play.golang.org/compile
And:
Format
Browser
→ ZgoCloud /fmt
→ play.golang.org/fmt
This step was very important.
Because the earlier code audit revealed that Run and Format do not have just a single unified request point.
Only after all three browser requests were correctly switched could the entire execution path migration be considered complete.
16. Page traffic and execution traffic are now truly separated
After completing this migration, the production environment effectively formed two completely different paths.
Normal page access:
Browser
→ EdgeOne
→ Alibaba Cloud Nginx
→ Go Tour
Code Run:
Browser
→ play.go-dev.shuijingwanwq.com:8443/compile
→ ZgoCloud Nginx
→ play.golang.org/compile
Format:
Browser
→ play.go-dev.shuijingwanwq.com:8443/fmt
→ ZgoCloud Nginx
→ play.golang.org/fmt
In other words:
Alibaba Cloud is now primarily responsible for page serving and no longer handles remote Playground forwarding for normal Run / Format.
The production server still does not execute user-submitted Go programs locally.
17. The experience of real public network testing on mobile has also noticeably improved
After completing the desktop Firefox acceptance, I went ahead and tested directly on a mobile device.
No additional network tools were used this time.
I directly opened the production version of A Tour of Go and clicked “Run”.
The actual experience was:
After clicking, the execution result returned basically very quickly.
This result is very meaningful to me.
Because the server-side:
curl
Test only proves that:
ZgoCloud
→ play.golang.org
Is working normally.
The desktop Network further proves that:
Browser
→ ZgoCloud
Has actually taken effect.
The actual usage in the mobile device’s real network environment further validated this complete path:
Mobile browser
→ ZgoCloud
→ play.golang.org
Can indeed return quickly under this test environment.
Of course, a single real-world usage cannot prove that the same performance will definitely be maintained in all regions, on all networks, and at all times.
But combined with:
ZgoCloud 100 consecutive test rounds
Desktop Firefox HTTP/2 acceptance
Mobile real public network experience
There is already multi-layered evidence indicating that this adjustment direction is effective.
18. The old Alibaba Cloud execution interfaces are temporarily retained
Currently, the Alibaba Cloud Go Tour still retains:
/_/compile
/_/fmt
And the corresponding:
https://go.dev/_
Server-side forwarding logic.
But the normal production browser will no longer use them.
I am not in a rush to delete them right now.
The reason is simple:
There is no need to immediately clean up compatibility and rollback capabilities that are already running stably just as the new path goes live.
It will be more prudent to wait until the new execution path has been running for a while before deciding whether to further reduce functionality.
So the current state is:
New path:
Officially in use
Old path:
Retained, but not serving as the normal browser execution path
19. The most memorable part this time is not the code, but the CDN cache
The code modifications themselves were not actually that complex this time.
What is truly easy to misjudge is:
Git commit successful
→ production bundle successful
→ automatic deployment successful
→ current switched
→ service restarted
→ official site HTTP 200
After all of these succeed:
The browser may still be executing old code.
Because the JavaScript that the user actually runs still goes through the CDN.
Therefore, going forward, as long as a release involves:
/tour/script.js
Or other resources that determine front-end behavior, it is not enough to just look at:
systemd
curl localhost
Official homepage HTTP status code
You must also open the browser Network panel and confirm:
Where the actual requests are really being sent.
If the Network panel hadn’t been checked this time, and only the page output was observed:
Hello, 世界
The fact that the execution path was still the old one would never have been discovered.
20. Final status
As of the completion of this release, the official production release is:
/data/go-tour/releases/20260813-zh-CN-1fe73f5
Corresponding code:
1fe73f54615b3d05d09133f6e25aa91c5fb07f75
Release status:
ready=103
pending=0
blocked=0
pages=103
articles=7
Release manifest:
execution_transport=http-playground-proxy
execution_provider=play.golang.org
local_socket_enabled=false
Real production acceptance:
Run → ZgoCloud /compile → HTTP 200
Format → ZgoCloud /fmt → Success
CORS → Normal
/socket → 404
Mobile real public network Run:
Success
And response was fast in this experience
At this point:
The migration of the A Tour of Go production Playground execution path to the fixed ZgoCloud execution node is complete.
Summary
On the surface, this migration simply changed:
/_/compile
/_/fmt
To:
https://play.go-dev.shuijingwanwq.com:8443/compile
https://play.go-dev.shuijingwanwq.com:8443/fmt
But once fully carried out, it actually involved:
Existing production request path audit
Production and local runtime mode distinction
Unification of Run and both Format requests
JavaScript configuration safety injection
CORS
Release manifest
Production deployment pre-check
Production bundle
Automated deployment
CDN cache
Browser Network acceptance
Mobile real-world usage acceptance
The resulting architecture is also clearer than before.
Pages handle pages:
Browser
→ EdgeOne
→ Alibaba Cloud
→ Go Tour
Execution handles execution:
Browser
→ ZgoCloud
→ play.golang.org
The two parts are no longer tightly bound to the same network path.
And the most valuable lesson from this deployment process, I believe, is not any specific piece of code, but rather:
When front-end behavior changes, a successful production deployment does not mean users have already received the new code. Final acceptance must ultimately fall on the real requests in the browser Network panel.
Only after seeing:
https://play.go-dev.shuijingwanwq.com:8443/compile
Actually appear in the browser’s request list can this migration be considered truly complete.

