Skip to content

About

No description, website, or topics provided.

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

English | 简体中文

guacamole_patch

An unofficial downstream patch for Apache Guacamole 1.6.0 that improves keyboard and IME recovery after browser tab switching, background suspension, and page lifecycle changes.

This repository is not an official Apache Software Foundation release.

Quick deployment

Pull the published image:

docker pull ghcr.io/trilogys/guacamole_patch:1.6.0-recovery6

Use it in Docker Compose:

services:
  guacamole:
    image: ghcr.io/trilogys/guacamole_patch:1.6.0-recovery6

Update only the Guacamole web container:

docker compose pull guacamole
docker compose up -d --force-recreate --no-deps guacamole
docker compose ps
docker compose logs --tail=100 guacamole

Docker reuses unchanged layers, so later pulls normally download only changed layers. Do not run docker compose down -v or delete database volumes.

Published image tags

  • 1.6.0-recovery6: current named recovery release documented by this package.
  • 1.6.0-recovery5: previous recovery release retained for rollback.
  • 1.6.0: current moving release image; this tag is updated on each release build.
  • main: latest image built from the main branch.
  • sha-<commit>: immutable tag for a specific source commit.
  • dev: development image built from the dev branch.

For production builds, run the workflow from main. Running it from dev also updates the shared 1.6.0 tag.

What the patch addresses

Guacamole Text input with a local IME

Remote Windows language: ENG
Guacamole input method: Text input
Local input method: Chinese IME

The patch recovers missing composition events, restores focus to the active connection, restores text/Backspace/Delete delivery, and prevents the hidden raw-keyboard input sink from stealing focus from the visible text field.

Microsoft Pinyin inside remote Windows

Guacamole input method: None
Local input language: ENG or a local IME
Remote Windows input method: Microsoft Pinyin
RDP keyboard layout: en-us-qwerty

The patch resets recorded key state when the page is hidden, restores keyboard capture after returning, releases stuck modifiers, handles long background suspension and page lifecycle events, and rebuilds Chromium's native input context on the first user gesture.

Manual recovery remains available through Ctrl+Alt+K and the Recover keyboard capture menu action.

Transient network warning

Guacamole normally marks a tunnel unstable after roughly 1.5 seconds without inbound data. The patch waits for three additional seconds of continuous, visible-page instability before showing the warning. It suppresses the warning while the page is hidden and starts a fresh grace period when the page returns.

The underlying instability detector and 15-second receive timeout are unchanged. Sustained network or server failures are still reported and disconnected normally.

An opt-in Delayed automatic page refresh switch is available under User settings → Connection Recovery and in the current connection menu. It is off by default. When off, no automatic action occurs and the lower-right warning retains Refresh page. When enabled, the first confirmed failure refreshes the entire current page after roughly five seconds and the second waits roughly ten seconds. Each browser tab is limited to two consecutive automatic refreshes; one stable minute resets the budget.

If the tunnel remains open but three intentional mouse presses receive no timely remote display sync for eight seconds, recovery also treats the downstream control path as wedged. Guacamole's display statistics and relative sync timing identify network queueing or browser rendering delays above three seconds. Active file transfers, disabling automatic refresh, or selecting Do not refresh cancel the pending action. If browser session storage cannot safely persist the cross-refresh counter, automatic refresh is disabled while manual refresh remains available.

A full-page refresh reloads authentication state, routing, and all tiled connections. A balancing group may select another backend and RDP may open a different remote session. Keep the option disabled and use a specific connection when the same host must be preserved.

Recovery6 revalidates the current document with Cache-Control: no-cache, clears Guacamole's stale-build refresh lock, and guarantees exactly one reload after request success, failure, or timeout. Refresh page is always available in the connection menu and is also shown while waiting for the first remote frame.

Black remote canvas after login

If Guacamole login and menus work but only the remote canvas is black, first use Refresh page in the connection menu. If that fails, restart guacd and restore the connection's display settings: leave color depth and DPI empty, and disable force-lossless while leaving Disable GFX and all three disable cache options unchecked. These settings live in the database and are not reverted with the web image.

Mouse response under weak networks

High-frequency mouse movement is coalesced to the latest position at roughly 30 Hz. Button presses, releases, right-clicks, wheel events, and drag endpoints flush the latest position first and are sent immediately, preventing clicks from waiting behind stale movement. Pending movement is discarded when the connection is replaced.

High display load from a remote browser

Chrome, Edge, video, animation, and complex page scrolling inside remote Windows generate substantial RDP display traffic. The patch detects severe backlog and recovers the connection, but cannot remove bottlenecks in the remote host, network, or guacd encoder. For the specific Guacamole RDP connection, prefer:

Recovery6 retains recovery4's display hot-path optimization: the live sync callback no longer flattens the full display every five seconds for thumbnails, and per-frame statistics are disabled by default and enabled with a one-second window only after intentional clicks. Thumbnails are still saved after the first connected frame and on disconnect.

  • with GFX enabled, leave color depth unset or use 32-bit color; compare 16-bit color only together with disable-gfx=true, as described below;
  • force-lossless disabled;
  • wallpaper, theming, font smoothing, full-window drag, desktop composition, and menu animations disabled;
  • bitmap, offscreen, and glyph caching enabled by leaving their "disable" options unchecked;
  • 1280x720 or 1600x900 with 96 DPI during initial troubleshooting.

Deployment tuning for FRP and high-latency networks

These are deployment-level troubleshooting and tuning notes that must be applied to the actual topology. Installing this web patch does not automatically change Nginx, FRP, firewall rules, or RDP connection parameters.

Shorten forwarding paths inside the server

When the HTTPS ingress, Guacamole web application, and FRP server share a host, avoid forwarding through that host's public address. One deployment changed:

Browser -> public HTTPS ingress -> server public address -> second Nginx -> Guacamole

to:

Browser -> public HTTPS ingress -> local Guacamole
guacd -> same-host frps private address:13389 -> frpc -> Windows:3389

The following location belongs inside an existing HTTPS server block. It assumes the ingress runs on the host or uses host networking, and Guacamole exposes /guacamole/ through host port 32768:

location / {
    proxy_pass http://127.0.0.1:32768/guacamole/;
    proxy_http_version 1.1;

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;

    proxy_buffering off;
    proxy_request_buffering off;
    proxy_cookie_path /guacamole/ /;
}
  • Replace the existing location rather than adding a duplicate. Preserve public TLS, authentication, access controls, and effective upload limits. Remove an inner proxy only after checking that it provides no additional security controls.
  • In a separate container network, 127.0.0.1 refers to the proxy itself. Use a reachable Docker service address such as http://guacamole:8080/guacamole/ instead. The example port is not a requirement.
  • Plain HTTP upstreams are appropriate only for the local host or a trusted container network; retain suitable transport protection across hosts.
  • This example maps the public root to upstream /guacamole/, including its cookie path. Adapt both mappings if the public path differs.
  • Disabling response buffering matters especially for HTTP tunnels; it does not directly reduce the network RTT of an established WebSocket. Disabling request buffering permits streaming request bodies.

Back up the configuration, run nginx -t, and gracefully reload only after validation succeeds. Check the homepage, assets, login, and WebSocket upgrade, then reconnect the desktop. HTTP 101 alone does not validate RDP login or responsiveness. To roll back, restore the original file, validate it, and gracefully reload.

RDP display settings: a comparison profile, not a universal optimum

Guacamole 1.6.0's GFX path requires 32-bit color. With GFX enabled, initially leave color depth unset or use 32 bits; requesting 16 bits does not override the GFX requirement.

To compare the legacy display path, try the following on the specific RDP connection. These are Guacamole connection parameters, not settings for frpc.toml or guacamole.properties:

disable-gfx=true
color-depth=16
width=1280
height=720
resize-method=display-update
force-lossless=false
dpi=96
enable-wallpaper=false
enable-theming=false
enable-font-smoothing=false
enable-desktop-composition=false
enable-full-window-drag=false
enable-menu-animations=false

This profile reduces color fidelity and is not guaranteed to outperform GFX. Compare identical content, resolution, and network conditions. Keep bitmap, offscreen, and glyph caches enabled. Reconnect after changing connection parameters. With display-update, the resolution can follow the browser window, so 1280x720 is the initial requested size, not a fixed maximum.

force-lossless=false does not disable all lossless compression: it lets Guacamole choose an encoding for the content. Avoid simultaneously forcing lossless compression while investigating latency.

FRP routing and access restrictions

  • When guacd and frps share a host, the RDP target can use a reachable private frps address and mapped port. Do not point a remote guacd at the Windows machine's local 127.0.0.1:3389.
  • If RDP is used only through Guacamole, restrict the mapped port, such as 13389, to trusted guacd/server sources. Verify the actual post-NAT source first, place specific rules before existing broad port-range allowances, and cover IPv4 and IPv6.
  • Recheck the allow rules when Docker addresses, networking modes, or public NAT addresses change. Do not disrupt other services sharing the frpc instance with a broad deny rule.
  • If the Windows host running frpc is intercepted by its own Mihomo TUN, append the FRP server's /32 address to the existing tun.route-exclude-address list. 198.51.100.10/32 is a documentation example only: replace it with the actual server address and retain existing exclusions.
  • A Mihomo DIRECT rule can still traverse TUN. Verify the persistent configuration, running configuration, and effective route after applying the change, for example with Windows Find-NetRoute -RemoteIPAddress <FRPS_IP>.
  • A TUN exclusion on the controlled Windows host does not change a different client computer's corporate egress, proxy, or VPN. The corporate network was left as-is in this case.
  • Do not blindly increase connection pools to silence work connection pool is full. Successful proxy registration does not prove that the local backend is running. A failed external RDP-port probe can be the intended result of the access policy.

Observed results and limits

In one deployment on 2026-10-27, removing the server's public-address round trip and extra proxy, and disabling request/response buffering produced these checks:

Check Result
Nginx configuration validation and graceful reload Passed
HTTPS homepage and before/after content comparison HTTP 200; identical content
WebSocket upgrade test HTTP 101; transport handshake only
Five same-host HTTPS homepage requests before and after Median total time approximately 41.6 ms -> 30.2 ms
Subsequent user feedback Remote interaction felt substantially smoother

These are observations from a particular deployment, not general performance guarantees. Homepage response time is not keypress-to-display latency and does not isolate the contribution of each change. Complete resolution of persistent red warnings still requires separate verification.

Earlier samples showed browser-facing TCP RTT around 179-180 ms, FRP-side RTT around 46-51 ms, and internal-server RTT around 0.1-0.2 ms. If a proxy terminates TCP, the server's RTT does not describe the entire client path; summing segment RTTs is only a rough estimate. A 12-second Windows sample showed no resource-related skipped frames and at most about 1 ms encoding time, which describes only that workload.

Distinguish whole-desktop lag from a slow browser application inside Windows. Observe the client, proxy, guacd, FRP, and Windows during actual interaction. Keep improvements that work and compare one variable at a time; a red warning, one ping, or low CPU alone does not establish the cause.

References: Guacamole reverse proxy, RDP connection parameters, FRP networking and connection pools, and Mihomo TUN route exclusions.

GitHub Actions build

Open Actions → Build and publish Guacamole recovery image → Run workflow, select main, and run the workflow.

A successful build publishes:

ghcr.io/trilogys/guacamole_patch:1.6.0
ghcr.io/trilogys/guacamole_patch:1.6.0-recovery6
ghcr.io/trilogys/guacamole_patch:main
ghcr.io/trilogys/guacamole_patch:sha-<commit>

Manual build

Requirements:

Docker
curl
patch
Python 3
tar
sha256sum
mktemp

Clone and build:

git clone https://github.com/trilogys/guacamole_patch.git
cd guacamole_patch

IMAGE_NAME="ghcr.io/trilogys/guacamole_patch:1.6.0-recovery6" \
bash ./build.sh

For a faster troubleshooting build:

MAVEN_ARGUMENTS="-T 1C -Dmaven.test.skip=true" \
IMAGE_NAME="ghcr.io/trilogys/guacamole_patch:1.6.0-recovery6" \
bash ./build.sh

build.sh verifies the patch package and Apache source archive, runs regression checks, dry-runs and applies the patch, builds the official Dockerfile, inspects the image, and runs an initdb smoke test.

Verify the image

docker image inspect ghcr.io/trilogys/guacamole_patch:1.6.0-recovery6 \
  --format '{{index .Config.Labels "io.guacamole.recovery.patch-sha256"}}'

Expected patch SHA-256:

0345d83616eefb0c23c6c8aad328739260beeb2bf0f0d645fc436d4f87f4de5f

Acceptance testing

See TEST_MATRIX.md for the complete procedure. At minimum, verify:

  • local Chinese IME with remote Windows set to ENG;
  • remote Microsoft Pinyin candidate selection;
  • repeated tab switching in Chrome and Edge;
  • no stuck Ctrl, Shift, or Alt keys;
  • Backspace, Delete, arrow keys, Enter, and numeric candidate selection;
  • reconnecting the same account;
  • rollback to a known working image.

Scope and limitations

The patch does not modify guacd, PostgreSQL schema or data, Nginx, FRP, connection accounts, recordings, or shared directories.

Shortcuts such as Win+Space and Alt+Tab may be intercepted by the local operating system or browser. Validate the image against the actual Windows RDP environment before production rollout.

License

This patch package is licensed under the Apache License 2.0. Apache Guacamole copyright and NOTICE requirements remain unchanged.

About

No description, website, or topics provided.

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages