260710_01_ENH: API Bypass 기능 추가

This commit is contained in:
2026-07-10 12:05:04 +09:00
parent 68dba04fd6
commit 94ea2592a7
15 changed files with 1155 additions and 1 deletions

View File

@@ -64,6 +64,7 @@ Known prefixes:
- `kri.swagger`
- `kri.web`
- `kri.web.mdc`
- `kri.http.bypass`
- `kri.redis`
- `kri.scheduling`
- `kri.error.expose`
@@ -81,6 +82,7 @@ Declared imports:
- `com.kri.common.autoconfigure.swagger.KriSwaggerAutoConfiguration`
- `com.kri.common.autoconfigure.redis.CommonRedisAutoConfiguration`
- `com.kri.common.autoconfigure.scheduling.CommonSchedulingAutoConfiguration`
- `com.kri.common.autoconfigure.http.bypass.BypassAutoConfiguration`
If a new auto-configuration must be active for consumers, add it to `AutoConfiguration.imports`.
@@ -162,6 +164,21 @@ Behavior:
- Requires `RedisTemplate` class and `RedisConnectionFactory` bean.
- Registers `RedisQueueHelper`.
### HTTP Bypass
- Public classes: `BypassClient`, `BypassRequest`, `BypassResponse`, `BypassContext`, `BypassForwardOptions`, `BypassRequestCustomizer`, `BypassResponseCustomizer`
- Runtime implementation: `DefaultBypassClient`
- Auto-config: `BypassAutoConfiguration`
- Config: `kri.http.bypass`
- Default enabled: `false`
- Requires servlet web classes.
- Consumer services define bypass controllers explicitly and call `BypassClient.forward(targetName, request, body)`.
- Targets are configured under `kri.http.bypass.targets.<targetName>` with `base-url`, optional `strip-prefix`, `allowed-paths`, `request-customizers`, `response-customizers`, and timeout.
- Target customizers are referenced by Spring bean name and run before per-request customizers from `BypassForwardOptions`.
- Response bodies are returned as `byte[]`; preserve target `Content-Type` so frontends can parse JSON/text/blob correctly.
- Do not allow frontends to pass arbitrary full target URLs. Keep target base URLs server-side and use `allowed-paths`.
- Do not forward hop-by-hop headers such as `Host`, `Content-Length`, `Transfer-Encoding`, `Connection`, `Keep-Alive`, `Upgrade`, `Proxy-Authenticate`, `Proxy-Authorization`, `TE`, and `Trailer`.
### Scheduling
- Auto-config: `CommonSchedulingAutoConfiguration`