a simple api gateway

鉴权网关

  • 根据登录接口返回UIN判断是否登录/退出成功
  • 自动添加跨域处理
  • 会话重启即失效
  • TLS鉴权
  • 负载均衡
    • 随机

Config

# 开启验证
enable_verify: false
# 验证证书
ca_path: "./conf/ca.pem"
module_cert_pem: "./conf/server.pem"
module_key_pem: "./conf/server.key"
# 请求将会通过UIN传输到后端
uin_header_name: "uin"
# 会话Cookie名称
cookie_name: "session"
# 登录SESSION位置 (leveldb) 废弃
session_path: "./conf/session"
# 会话过期时间(秒)
session_expire_in: 3600
# 配置热加载(秒)
hot_load: 60
# 登录页面
sign_page: "https://dxkite.cn"
# 跨域配置
cors_config:
  allow_origin:
    - "http://127.0.0.1:2333"
  allow_method:
    - GET
    - POST
sign_info:
  redirect_name: "redirect_uri"
  redirect_url: "https://dxkite.cn"
# 路由配置
routes:
  - pattern: "/signin.php"
    signin: true # 登录接口
    backend:
      - http://127.0.0.1:8088
  - pattern: "/signout.php"
    sign: true
    signout: true # 登出接口
    backend:
      - http://127.0.0.1:8088
  - pattern: "/user"
    sign: true #需要登录才能访问
    backend:
      - https://114.132.243.178?server_name=nginx
  - pattern: "/" # 普通非鉴权接口
    backend:
      - https://114.132.243.178?server_name=nginx

Nginx 开启双向认证

# 服务器证书
ssl_certificate /cert/fullchain.pem;
ssl_certificate_key /cert/privkey.pem;
# Client验证CA
ssl_client_certificate /cert/ca.pem;
# 验证Client
ssl_verify_client on;

Nginx 反向代理

location / {
  proxy_pass https://127.0.0.1:2333;
  proxy_ssl_name gateway;
  proxy_ssl_certificate /gateway/nginx.pem;
  proxy_ssl_certificate_key /gateway/nginx.key;
  proxy_ssl_trusted_certificate /gateway/conf/ca.pem;
  proxy_ssl_server_name on;
  proxy_ssl_verify on;
}
Similar Resources

Cortex Gateway: a microservice which strives to help you administrating and operating your Cortex Cluster in multi tenant environments

Cortex Gateway: a microservice which strives to help you administrating and operating your Cortex Cluster in multi tenant environments

Cortex Gateway Cortex Gateway is a microservice which strives to help you administrating and operating your Cortex Cluster in multi tenant environment

Jan 14, 2022

Search-gateway - Golang restfull Service

Search Gateway Specifications Gin framework Development PORT=3000 go run main.go

Jan 25, 2022

This project extends the go-chi router to support OpenAPI 3, bringing to you a simple interface to build a router conforming your API contract.

Go OpenAPI This project extends the go-chi router to support OpenAPI 3, bringing to you a simple interface to build a router conforming your API contr

Mar 27, 2022

CRUD API server of Clean Architecture with Go(Echo), Gorm, MySQL, Docker and Swagger

CRUD API server of Clean Architecture with Go(Echo), Gorm, MySQL, Docker and Swagger

CRUD API Server of Clean Architecture Go(echo) gorm mysql docker swagger build docker-compose up -d --build API Postman and Fiddler is recommended to

May 30, 2021

以 `Go` 语言,采用 斗鱼 微服务框架Jupiter 实现后端 API 开发

以 `Go` 语言,采用 斗鱼 微服务框架Jupiter 实现后端 API 开发

lightning-go 环境依赖 版本依赖 Go 1.14+ MySQL 5.7+ Redis 3.2+ 模块介绍 多云云主机生命周期管理 阿里云 腾讯云 华为云 亚马逊 消息中心 任务调度 触发Dag任务 查询Dag详情 查看任务日志 定时任务 项目目录结构

Jun 18, 2022

Microservice Boilerplate for Golang with gRPC and RESTful API. Multiple database and client supported

Microservice Boilerplate for Golang with gRPC and RESTful API. Multiple database and client supported

Go Microservice Starter A boilerplate for flexible Go microservice. Table of contents Features Installation Todo List Folder Structures Features: Mult

Jul 28, 2022

Golang client for Ethereum and Flashbots JSON-RPC API calls.

Flashbots RPC client Fork of ethrpc with additional Flashbots RPC methods: FlashbotsGetUserStats FlashbotsCallBundle FlashbotsSendBundle FlashbotsSimu

Jan 5, 2023

A gRPC API for Warhammer Age of Sigmar

Warhammer 🔥 A gRPC API for Warhammer Age of Sigmar Intro ℹ️ Skip to Quick Start What is this? An API for creating, reading, deleting, and updating a

Oct 26, 2021

Go microservice for proxying the Twitch API.

Simple drop-in proxy server for the Twitch API. Built for use with microservice architecture in mind.

Mar 17, 2022
a simple api gateway

鉴权网关 根据登录接口返回UIN判断是否登录/退出成功 自动添加跨域处理 会话重启即失效 TLS鉴权 负载均衡 随机 Config # 开启验证 enable_verify: false # 验证证书 ca_path: "./conf/ca.pem" module_cert_pem: "./conf

Feb 10, 2022
A simple HTTP/HTTPS API Gateway in Golang.
A simple HTTP/HTTPS API Gateway in Golang.

mice A simple API Gateway in Golang. Installation: Using go install: First install Go, if not already there Set GOPATH and GOBIN if not already set as

May 19, 2022
HTTP API Gateway
HTTP API Gateway

Manba/简体中文 Manba is a restful API gateway based on HTTP, which can be used as a unified API access layer. Tutorial A very detailed tutorial for beginn

Dec 29, 2022
This is a shopping basket workshop that shows how to use KrakenD API Gateway.
This is a shopping basket workshop that shows how to use KrakenD API Gateway.

Go Restful Microservices and KrakenD API Gateway Workshop This is a shopping basket workshop that shows how to use KrakenD API Gateway. Consist of 5 m

Jan 3, 2023
Test your API gateway routed lambdas locally and in CI
Test your API gateway routed lambdas locally and in CI

Lambo Test API Gateway wrapped lambda functions locally. Lambo can also be used to test API GW lambdas in CI without needing docker-in-docker. It will

Jun 22, 2022
The Consul API Gateway is a dedicated ingress solution for intelligently routing traffic to applications running on a Consul Service Mesh.

The Consul API Gateway is a dedicated ingress solution for intelligently routing traffic to applications running on a Consul Service Mesh.

Dec 14, 2022
A gateway to expose s3 standard API for any storage type.

s3-gateway this project is used to be compatible with any other storage type. there are tons of object storage services in the internat. However, many

Nov 28, 2021
TiDB Gateway

TiDB Gateway Building go build Running ./tidbgw Optionally set the address of PD and address to listen on via flags. Using Connect your MySQL client

Jul 15, 2022
Blue is a lightweight cloud-native gateway solution to handle millions of routing endpoints with a large number of connections.
Blue is a lightweight cloud-native gateway solution to handle millions of routing endpoints with a large number of connections.

Blue is a lightweight cloud-native gateway solution to handle millions of routing endpoints with a large number of connections.

Jan 19, 2022
Micro-serviço em Golang para processar pagamentos de um Gateway.
Micro-serviço em Golang para processar pagamentos de um Gateway.

Go Payment Processor Projeto Este repositório contém um micro-serviço em Golang que faz parte de um conjunto de serviços necessário para o projeto do

Dec 13, 2021