Git Product home page Git Product logo

spring-cloud-gateway-hello-world's Introduction

Spring Cloud Gateway for Hello World App

Spring Cloud Getting Started for Gataway

Description

Building Block for Gateway

Name Description
Route Primary API of the Gateway
Defined by followings
- ID
- Destination(URI)
- Set of Predicates and Fileters
Predicate HTTP Request Matching
Java 8 Function Predicate
Used for followings
- Header
- Method
- Parameter
Filter Spring WebFilter
Modification of the incoming HTTP request or outgoing HTTP response

Route Predicate Factories

  • After Route Predicate Factory
predicates:
- After=2017-01-20T17:42:47.789-07:00[America/Denver]
  • Before Route Predicate Factory
predicates:
- Before=2017-01-20T17:42:47.789-07:00[America/Denver]
  • Between Route Predicate Factory
predicates:
- Between=2017-01-20T17:42:47.789-07:00[America/Denver], 2017-01-21T17:42:47.789-07:00[America/Denver]
  • Cookie Route Predicate Factory
predicates:
- Cookie=chocolate, ch.p
  • Header Route Predicate Factory
predicates:
- Header=X-Request-Id, \d+
  • Host Route Predicate Factory
predicates:
- Host=**.somehost.org,**.anotherhost.org
  • Method Route Predicate Factory
predicates:
- Method=GET
  • Path Route Predicate Factory
predicates:
- Path=/foo/{segment},/bar/{segment}
  • Query Route Predicate Factory
predicates:
- Query=baz
  • RemoteAddr Route Predicate Factory
predicates:
- RemoteAddr=192.168.1.1/24
  • Weight Route Predicate Factory
routes:
- id: weight_high
  uri: https://weighthigh.org
  predicates:
  - Weight=group1, 8
- id: weight_low
  uri: https://weightlow.org
  predicates:
  - Weight=group1, 2

GatewayFilter Factory

  • AddRequestHeader
  • AddRequestParameter
  • AddResponseHeader
  • DedupeResponseHeader
  • MapRequestHeade
  • PrefixPath
  • PreserveHostHeader
  • RequestRateLimiter
  • RedirectTo
  • RemoveHopByHopHeadersFilter
  • RemoveRequestHeader
  • RemoveResponseHeade
  • RemoveRequestParameter
  • RewritePath
  • RewriteLocationResponseHeader
  • RewriteResponseHeader
  • SaveSession
  • SecureHeaders
  • SetPath
  • SetRequestHeader
  • SetResponseHeader
  • SetStatus
  • StripPrefix
  • Retry
  • RequestSize
  • Modify Request Body
  • Modify Response Body

Default Fileter

spring:
  cloud:
    gateway:
      default-filters:
      - AddResponseHeader=X-Response-Default-Foo, Default-Bar
      - PrefixPath=/httpbin

Demo

Routing to HTTPBIN access

  • application.yml
server:
  port: 8080
spring:
  application:
    name: gateway
  cloud:
    gateway:
      routes:
        - id: hello
          uri: http://httpbin.org
          predicates:
            - Path=/post
          filters:
            - AddRequestHeader=X-Request-Hello, PostWold

Features

  • feature:1
  • feature:2

Requirement

  • httpbin.org
    • A simple HTTP Request & Response Service.

Usage

Installation

Licence

Released under the MIT license

Author

shinyay

spring-cloud-gateway-hello-world's People

Contributors

shinyay avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.