fix(office_ui): proper X-Forwarded headers + same-origin api.js bootstrap #17
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_office!17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_fix_office_ui_xforwarded_headers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Editor now bootstraps from any client that can reach hero_router — no need for a direct route to the OnlyOffice container (mycelium / public IP). Three corresponding fixes inside
hero_office_ui:X-Forwarded-Hostcarries only host:port (RFC 7239 compliant); path-prefix moves to a separateX-Forwarded-Prefixheader. Previously the prefix was packed intoX-Forwarded-Hostand OnlyOffice URL-encoded the underscore (_→%5f), mangling every cache URL it generated.X-Forwarded-Protodefaults tohttp(washttps). Every Hero deployment we run today is HTTP at the hero_router layer.<script src="$prefix/onlyoffice/web-apps/...api.js">(same-origin) instead of<script src="$OO_SERVER_URL/...">(direct OO). Browsers can bootstrap DocsAPI through the proxy without a route to OnlyOffice.Related Issue
Closes #16
Changes
crates/hero_office_ui/src/handlers.rs— semantic fix (X-Forwarded-* + same-origin api.js); also 11 mechanical clippy 1.94 fixes (collapsible_if, useless_conversion)crates/hero_office_ui/src/{config,main,state}.rs— fmt drift cleanup (unblocks/ci-check)Test Results
cargo fmt --check -- crates/hero_office_ui/src/handlers.rs✅cargo check --workspace✅cargo clippy -p hero_office_ui -- -D warnings✅npx playwright test office_editor_real4/4 ✅ (regression unchanged)Manual verification
Editor loads + document body renders end-to-end from a mac browser via SSH tunnel (
ssh -N -L 9988:127.0.0.1:9988 herodev→http://127.0.0.1:9988/hero_os/ui/). Previous behaviour:ERR_ADDRESS_UNREACHABLEon api.js, thenERR_SSL_PROTOCOL_ERROR/ mangled cache URLs. New behaviour: editor renders.Caveat
Change #2 affects future HTTPS-fronted deployments. When we eventually put TLS in front of hero_router, the gateway must explicitly set
X-Forwarded-Proto: https— same as any other reverse-proxy setup.