Commit Graph

1558 Commits

Author SHA1 Message Date
yusing
aa2575696d fix(http): handle 0 content length properly in some cases v0.20.11 2025-12-04 17:33:01 +08:00
yusing
c1f9c2c957 fix(middleware): skip modification for HEAD requests in ModifyHTML middleware 2025-12-04 17:27:26 +08:00
yusing
c098fef615 fix(http): enhance Content-Length handling in ResponseModifier
- Introduced origContentLength and bodyModified fields to track original content length and body modification status.
- Updated ContentLength and ContentLengthStr methods to return accurate content length based on body modification state.
- Adjusted Write and FlushRelease methods to ensure proper handling of Content-Length header.
- Modified middleware to use the new ContentLengthStr method.
2025-12-04 17:26:15 +08:00
yusing
9cdc985fb0 fix(tests): correct test expectations for middleware bypass and rules 2025-12-04 16:18:14 +08:00
yusing
2034738422 refactor(labels): refine wildcard expansion logic and tests
- Added multiple test cases for the ExpandWildcard function to cover various scenarios including basic wildcards, no wildcards, empty labels, and YAML configurations.
- Improved handling of nested maps and invalid YAML inputs.
- Ensured that explicit labels and reference aliases are correctly processed and expanded.
2025-12-04 16:16:43 +08:00
yusing
55a42b81de refactor(healthcheck): streamline health check configuration and defaults
- Moved health check constants from common package alongside type definition.
- Updated health check configuration to use struct directly instead of pointers.
- Introduced global default health check config
2025-12-04 15:19:10 +08:00
yusing
48627753d6 refactor(routes): simplify route exclusion check and health check defaults 2025-12-04 15:12:35 +08:00
yusing
09b514393d chore(deps): upgrade go version and dependencies 2025-12-04 12:18:12 +08:00
yusing
3b2ae5dbd6 refactor: move some utility functions to goutils and update references 2025-12-04 12:17:33 +08:00
yusing
fac3d67a51 chore; update goutils v0.20.10 2025-11-23 11:46:04 +08:00
yusing
cb642d7b32 fix(middleware): correct body mutation behavior in ServeHTTP
Refactor ServeHTTP to properly handle response body mutations by:
- Using ResponseModifier to capture response before modification
- Reading body content and allowing middleware to modify it
- Writing modified body back if changed during modification
- Ensuring proper order: RequestModifier before, ResponseModifier after next()

Previously, httputils.NewModifyResponseWriter did not correctly handle
body mutations. The new implementation captures the full response,
allows modification via modifyResponse, and properly writes back any
changes to the body.

Add BodyReader() and SetBody() methods to ResponseModifier to support
reading and replacing response body content.
v0.20.9
2025-11-17 16:32:58 +08:00
yusing
9285977495 chore(deps): upgrade dependencies 2025-11-17 15:15:06 +08:00
yusing
e00cd8a35b fix(http): add Body field to response ModifyResponseWriter to avoid nil dereference panic 2025-11-17 15:12:13 +08:00
yusing
8ac459c038 fix(rules): ignore unsupported flush errors in ResponseModifier 2025-11-17 10:59:20 +08:00
yusing
1bcaf0dab5 fix(docker): revert to API version negotiation for Docker client 2025-11-15 10:52:03 +08:00
yusing
a291a49a0e fix(swagger): update netip.Addr definition type to string 2025-11-14 22:28:29 +08:00
yusing
28fdf3d2f4 fix(types/route): update HealthCheck JSON tag to be nullable for load-balancer routes 2025-11-14 22:16:30 +08:00
yusing
84b17baf46 refactor(rules): correct json format; remove MarshalJSON from []Rules 2025-11-14 20:53:35 +08:00
yusing
06ddb178f8 fix(proxmox): handle case when no nodes are available in AvailableNodeNames function 2025-11-14 10:59:58 +08:00
yusing
61fa7d2665 chore(debug): add debug logging for bypass rules and remove for route validation 2025-11-14 10:58:55 +08:00
yusing
615521ee1c chore: update submodule goutils 2025-11-14 10:33:11 +08:00
yusing
bbe308e821 ci: add Jenkinsfile for CI pipeline and configure SonarQube analysis 2025-11-13 23:39:23 +08:00
yusing
c156173757 refactor(docker): migrate from github.com/docker/docker to github.com/moby/moby 2025-11-13 23:03:27 +08:00
yusing
b1aae1cacf fix(rule): allow manifest.json in webui rule to make PWA work properly 2025-11-13 20:51:20 +08:00
yusing
f46552b477 fix(log): fix scrambled config log output 2025-11-13 20:49:38 +08:00
yusing
efe1350ffd chore: upgrade dependencies 2025-11-13 15:30:15 +08:00
yusing
219eedf3c5 fix(oidc): correct behavior when working with bypass rules
- Introduced a new handler for unknown paths in the OIDCProvider to prevent fallback to the default login page.
- Forced OIDC middleware to treat unknown path as logic path to redirect to login property when bypass rules is declared.
- Refactored OIDC path constants.
- Updated checkBypass middleware to enforce path prefixes for bypass rules, ensuring proper request handling.
v0.20.8
2025-11-13 15:13:20 +08:00
yusing
f6dcc8f118 fix(idlewatcher): correct variable declaration for event data parsing in loading.js v0.20.7 2025-11-07 17:08:58 +08:00
yusing
4d6541c851 chore(deps): update Go version in Dockerfile and go mod tidy 2025-11-07 16:35:35 +08:00
yusing
c9db350cbc fix(route): add workaround for WebUI rule preset loading in validateRules function
- Introduced a temporary fix for loading the "webui.yml" rule preset when the container image is "godoxy-frontend".
- Added error handling for cases where the rule preset is not found.
- Marked the change with a FIXME comment to investigate the underlying issue in the future.
2025-11-07 16:16:58 +08:00
yusing
56374d595a fix(idlewatcher): correct target URL validation logic in NewWatcher function 2025-11-07 15:55:56 +08:00
yusing
d81521f293 refactor: improve HTTPS detection logic by using case-insensitive comparison for X-Forwarded-Proto header 2025-11-07 15:49:51 +08:00
yusing
e9ac3cd1a9 refactor: fix incorrect logic introduced in previous commits and improve error handling 2025-11-07 15:48:38 +08:00
yusing
d33ff2192a refactor(loadbalancer): implement sticky sessions and improve algorithm separation
- Refactor load balancer interface to separate server selection (ChooseServer) from request handling
- Add cookie-based sticky session support with configurable max-age and secure cookie handling
- Integrate idlewatcher requests with automatic sticky session assignment
- Improve algorithm implementations:
  * Replace fnv with xxhash3 for better performance in IP hash and server keys
  * Add proper bounds checking and error handling in all algorithms
  * Separate concerns between server selection and request processing
- Add Sticky and StickyMaxAge fields to LoadBalancerConfig
- Create dedicated sticky.go for session management utilities
2025-11-07 15:24:57 +08:00
yusing
910ef639a4 feat(idlewatcher): implement real-time SSE-based loading page with enhanced UX
This major overhaul of the idlewatcher system introduces a modern, real-time loading experience with Server-Sent Events (SSE) streaming and improved error handling.

- **Real-time Event Streaming**: New SSE endpoint (`/$godoxy/wake-events`) provides live updates during container wake process
- **Enhanced Loading Page**: Modern console-style interface with timestamped events and color-coded status messages
- **Improved Static Asset Management**: Dedicated paths for CSS, JS, and favicon to avoid conflicting with upstream assets
- **Event History Buffer**: Stores wake events for reconnecting clients and debugging

- Refactored HTTP request handling with cleaner static asset routing
- Added `WakeEvent` system with structured event types (starting, waking_dep, dep_ready, container_woke, waiting_ready, ready, error)
- Implemented thread-safe event broadcasting using xsync.Map for concurrent SSE connections
- Enhanced error handling with detailed logging and user-friendly error messages
- Simplified loading page template system with better asset path management
- Fixed race conditions in dependency waking and state management

- Removed `common.go` functions (canceled, waitStarted) - moved inline for better context
- Updated Waker interface to accept context parameter in Wake() method
- New static asset paths use `/$godoxy/` prefix to avoid conflicts

- Console-style output with Fira Code font for better readability
- Color-coded event types (yellow for starting, blue for dependencies, green for success, red for errors)
- Automatic page refresh when container becomes ready
- Improved visual design with better glassmorphism effects and responsive layout
- Real-time progress feedback during dependency wake and container startup

This change transforms the static loading page into a dynamic, informative experience that keeps users informed during the wake process while maintaining backward compatibility with existing routing behavior.
2025-11-07 14:58:33 +08:00
yusing
3cbd70f73a fix(health_check): correct agent routes health check logic 2025-11-07 10:21:15 +08:00
yusing
83d70d3bb2 fix(health_monitor): fix UpdateURL behavior in Docker and AgentProxied health monitor 2025-11-07 00:53:34 +08:00
yusing
bbb1b8497f fix(health_monitor): treat some errors as unhealth instead of actual error in RawHealthMonitor 2025-11-06 23:37:34 +08:00
yusing
d57d76dc65 feat(loading_page): move loading page css to style.css and serve as static asset 2025-11-06 20:32:40 +08:00
yusing
ef893974ea feat(route): implement PreferOver method for deterministic route replacement 2025-11-06 20:19:49 +08:00
yusing
b90f2409ab refactor(docker): set alias initially to have better debuggability 2025-11-06 20:15:03 +08:00
yusing
36e9b0d416 chore: upgrade go to 1.25.4 and dependencies 2025-11-06 20:13:01 +08:00
yusing
306cb7a20e fix(access_logger): fix stdout and path not working at the same time v0.20.6 2025-11-01 12:07:22 +08:00
yusing
e3915210aa fix(time): data race in DefaultTimeNow 2025-11-01 02:18:24 +08:00
yusing
e8fb202ea9 fix(docker): fix wildcard not working correctly with #N ref aliases 2025-11-01 02:10:09 +08:00
yusing
082b2f5da2 refactor(websocket): use only the first error and fix race condition 2025-11-01 01:28:12 +08:00
yusing
e670acb4b8 fix(access_logger): nil panic when stdout only, improve concurrency safety 2025-11-01 01:17:55 +08:00
yusing
77e486f4fe refactor(route): ensure validation and start only starts once, and lock error before finishing v0.20.5 2025-10-31 18:10:09 +08:00
yusing
3ccaba3163 fix(validation): prioritize pointer method for custom validation in serialization 2025-10-31 18:06:41 +08:00
yusing
705923960c feat(fileserver): add rules support for fileservers 2025-10-31 17:32:37 +08:00