可以为请求添加懒猫微服应用免登的自定义用户ID(X-HC-User-ID)和角色头部(X-HC-User-Role)。
- 将请求转发到指定的目标URL
- 自动添加 X-HC-User-ID 和 X-HC-User-Role 请求头
- 支持通过命令行参数配置
- 跨平台支持(Windows、macOS、Linux)
# 使用默认配置运行
./lzc-uid-impersonation
# 自定义配置运行
./lzc-uid-impersonation -user testuser -role admin -target http://localhost:8080 -listen :8082
-user
: 要模拟的用户名(默认值: "glzjin")-role
: 要模拟的角色(默认值: "ADMIN",将自动转换为大写)-target
: 要代理的目标URL(默认值: "http://127.0.0.1:8080")-listen
: 监听地址(默认值: ":8081")
你可以从 Releases 页面下载最新版本。根据你的操作系统选择对应的版本:
- Windows:
lzc-uid-impersonation-windows-amd64.exe
- Linux:
lzc-uid-impersonation-linux-amd64
- macOS Intel芯片:
lzc-uid-impersonation-darwin-amd64
- macOS Apple芯片:
lzc-uid-impersonation-darwin-arm64
go build -o lzc-uid-impersonation main.go
A reverse proxy tool that adds custom user ID (X-HC-User-ID) and role headers (X-HC-User-Role) for LazyCat microservice application auto-login.
- Forwards requests to a specified target URL
- Adds custom X-HC-User-ID and X-HC-User-Role headers
- Configurable through command line arguments
- Cross-platform support (Windows, macOS, Linux)
# Basic usage with default values
./lzc-uid-impersonation
# Custom configuration
./lzc-uid-impersonation -user testuser -role admin -target http://localhost:8080 -listen :8082
-user
: Username to impersonate (default: "glzjin")-role
: Role to impersonate (default: "ADMIN", will be converted to uppercase)-target
: Target URL to proxy to (default: "http://127.0.0.1:8080")-listen
: Address to listen on (default: ":8081")
You can download the latest release from the Releases page. Choose the appropriate version for your platform:
- Windows:
lzc-uid-impersonation-windows-amd64.exe
- Linux:
lzc-uid-impersonation-linux-amd64
- macOS Intel:
lzc-uid-impersonation-darwin-amd64
- macOS Apple Silicon:
lzc-uid-impersonation-darwin-arm64
go build -o lzc-uid-impersonation main.go