Skipper

HTTP Router and Reverse Proxy | HTTP 路由器和反向代理

关于 Skipper

Skipper 是一个强大的 HTTP 路由器和反向代理,由 Zalando 开发并开源,专为服务组合和高性能场景设计,包括 Kubernetes Ingress 等用例。

🚀 高性能

可处理大规模动态路由配置,生产环境支持超过 80 万条路由,每秒 6 万次请求

🔧 灵活配置

使用 eskip 格式配置路由,支持丰富的过滤器和谓词

🎯 功能丰富

支持路径重写、限流、请求修改、负载均衡等多种功能

📊 可观测性

内置 Prometheus 指标支持,方便监控和分析

快速开始

💡 Lazycat 平台部署
Lazycat 平台上,你可以一键部署 Skipper,无需手动配置 Docker。部署后即可开始配置路由规则。

快速测试链接

点击以下链接测试已配置的路由:

🔍 搜索引擎代理

🐱 Lazycat 平台

🔄 重定向

配置文件位置

在 Lazycat 平台上,路由配置文件位于:

/data/appvar/cloud.lazycat.app.liu.skipper/config/routes.eskip

路由配置语法

路由使用 eskip 格式配置,基本语法:

ID: Predicate() -> filter() -> BACKEND
  • ID: 路由唯一标识符
  • Predicate: 请求匹配规则(路径、方法、主机、头部等)
  • Filter: 请求/响应修改(添加头部、重写路径、限流等)
  • Backend: 目标服务 URL 或静态响应

配置示例

1. 简单反向代理

将请求代理到后端服务:

google: Path("/google") -> "https://www.google.com";

2. 静态响应

返回静态内容,无需后端服务:

hello: Path("/hello") -> inlineContent("Hello World!") -> <shunt>;

3. 路径重写

修改请求路径后转发:

api: Path("/api/*path") -> modPath("^/api", "") -> "https://api.example.com";

4. 添加请求头

为请求添加自定义头部:

headers: Path("/test") -> setRequestHeader("X-Custom", "value") -> "https://backend.com";

5. 限流保护

限制客户端请求频率(每分钟 100 次):

limited: Path("/limited") -> clientRatelimit(100, "1m") -> "https://backend.com";

6. 健康检查

添加健康检查端点:

health: Path("/health") -> inlineContent("OK") -> <shunt>;

常用测试命令

测试路由

使用以下命令测试你的路由配置:

# 测试 Hello World 路由
curl https://your-domain.com/hello

# 测试代理路由
curl https://your-domain.com/google

# 测试 API 代理
curl https://your-domain.com/api/users

查看服务状态

Skipper 支持端口(9911)提供管理功能:

# 查看所有加载的路由
curl http://your-domain.com:9911/routes

# 查看 Prometheus 指标(如果启用)
curl http://your-domain.com:9911/metrics

端口说明

  • 9090 - 主 HTTP 代理端口,处理所有路由请求
  • 9911 - 支持/监控端口,提供健康检查、路由查看、指标等功能

修改配置

  1. 编辑配置文件 /data/appvar/cloud.lazycat.app.liu.skipper/config/routes.eskip
  2. 保存文件后,重启 Skipper 服务使配置生效
  3. 使用测试命令验证新配置是否正常工作
⚠️ 注意
修改配置文件后必须重启服务才能生效。建议在修改前先备份原配置文件。

进阶功能

启用 Prometheus 指标

通过环境变量启用指标收集:

SKIPPER_EXTRA_ARGS=-enable-prometheus-metrics

然后通过管理端口访问 http://your-domain.com:9911/metrics 查看指标。

配置日志

添加访问日志记录:

SKIPPER_EXTRA_ARGS=-access-log-disabled=false

负载均衡

配置多个后端服务的负载均衡:

lb: Path("/app") -> lbBackend("http://backend1:8080", "http://backend2:8080");

官方文档

更多详细配置和功能,请参考官方文档:

About Skipper

Skipper is a powerful HTTP router and reverse proxy developed and open-sourced by Zalando, designed for service composition and high-performance scenarios, including use cases like Kubernetes Ingress.

🚀 High Performance

Handles large-scale dynamic routing configurations, supporting over 800,000 routes and 60,000 requests per second in production

🔧 Flexible Configuration

Configure routes using eskip format with rich filters and predicates

🎯 Feature Rich

Supports path rewriting, rate limiting, request modification, load balancing, and more

📊 Observability

Built-in Prometheus metrics support for easy monitoring and analysis

Quick Start

💡 Lazycat Platform Deployment
On Lazycat Platform, you can deploy Skipper with one click without manual Docker configuration. Start configuring routing rules after deployment.

Quick Test Links

Click the links below to test configured routes:

🔍 Search Engine Proxies

🐱 Lazycat Platform

🧪 Example Endpoints

🔄 Redirect

Configuration File Location

On Lazycat platform, the routing configuration file is located at:

/data/appvar/cloud.lazycat.app.liu.skipper/config/routes.eskip

Routing Configuration Syntax

Routes are configured using eskip format, basic syntax:

ID: Predicate() -> filter() -> BACKEND
  • ID: Unique route identifier
  • Predicate: Request matching rules (path, method, host, headers, etc.)
  • Filter: Request/response modifications (add headers, rewrite paths, rate limiting, etc.)
  • Backend: Target service URL or static response

Configuration Examples

1. Simple Reverse Proxy

Proxy requests to a backend service:

google: Path("/google") -> "https://www.google.com";

2. Static Response

Return static content without a backend service:

hello: Path("/hello") -> inlineContent("Hello World!") -> <shunt>;

3. Path Rewriting

Modify request path before forwarding:

api: Path("/api/*path") -> modPath("^/api", "") -> "https://api.example.com";

4. Add Request Headers

Add custom headers to requests:

headers: Path("/test") -> setRequestHeader("X-Custom", "value") -> "https://backend.com";

5. Rate Limiting

Limit client request frequency (100 requests per minute):

limited: Path("/limited") -> clientRatelimit(100, "1m") -> "https://backend.com";

6. Health Check

Add health check endpoint:

health: Path("/health") -> inlineContent("OK") -> <shunt>;

Common Test Commands

Test Routes

Use the following commands to test your routing configuration:

# Test Hello World route
curl https://your-domain.com/hello

# Test proxy route
curl https://your-domain.com/google

# Test API proxy
curl https://your-domain.com/api/users

Check Service Status

Skipper support port (9911) provides management features:

# View all loaded routes
curl http://your-domain.com:9911/routes

# View Prometheus metrics (if enabled)
curl http://your-domain.com:9911/metrics

Port Description

  • 9090 - Main HTTP proxy port, handles all routing requests
  • 9911 - Support/monitoring port, provides route viewing, metrics, etc.

Modifying Configuration

  1. Edit the configuration file /data/appvar/cloud.lazycat.app.liu.skipper/config/routes.eskip
  2. After saving, restart the Skipper service for changes to take effect
  3. Use test commands to verify the new configuration works correctly
⚠️ Note
You must restart the service after modifying the configuration file. It's recommended to backup the original configuration before making changes.

Advanced Features

Enable Prometheus Metrics

Enable metrics collection via environment variable:

SKIPPER_EXTRA_ARGS=-enable-prometheus-metrics

Then access http://your-domain.com:9911/metrics through the admin port to view metrics.

Configure Logging

Add access log recording:

SKIPPER_EXTRA_ARGS=-access-log-disabled=false

Load Balancing

Configure load balancing across multiple backend services:

lb: Path("/app") -> lbBackend("http://backend1:8080", "http://backend2:8080");

Official Documentation

For more detailed configuration and features, please refer to the official documentation: