spring-cloud-gateway | A Gateway built on Spring Framework and Spring Boot providing routing and more | REST library

 by   spring-cloud Java Version: 3.1.9 License: Apache-2.0

kandi X-RAY | spring-cloud-gateway Summary

kandi X-RAY | spring-cloud-gateway Summary

spring-cloud-gateway is a Java library typically used in Web Services, REST, Spring Boot, Spring, Swagger applications. spring-cloud-gateway has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub, Maven.

This project provides an API Gateway built on top of the Spring Ecosystem, including: Spring 6, Spring Boot 3 and Project Reactor. Spring Cloud Gateway aims to provide a simple, yet effective way to route to APIs and provide cross cutting concerns to them such as: security, monitoring/metrics, and resiliency.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              spring-cloud-gateway has a highly active ecosystem.
              It has 4056 star(s) with 3026 fork(s). There are 220 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 387 open issues and 1913 have been closed. On average issues are closed in 127 days. There are 53 open pull requests and 0 closed requests.
              OutlinedDot
              It has a negative sentiment in the developer community.
              The latest version of spring-cloud-gateway is 3.1.9

            kandi-Quality Quality

              spring-cloud-gateway has 0 bugs and 0 code smells.

            kandi-Security Security

              spring-cloud-gateway has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              spring-cloud-gateway code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              spring-cloud-gateway is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              spring-cloud-gateway releases are available to install and integrate.
              Deployable package is available in Maven.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              It has 29007 lines of code, 2760 functions and 398 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed spring-cloud-gateway and discovered the below as its top functions. This is intended to give you an instant insight into spring-cloud-gateway implemented functionality, and help decide if they suit your requirements.
            • This method filters the request
            • Get the response timeout
            • Creates a new HttpClient instance configured with the given route configuration
            • Filters the given headers using the given type
            • Adds the request uri
            • Get hint from load balancer properties
            • Chooses a load balancer
            • Constructs a path from config
            • Put uri template variables in exchange
            • Returns a gateway filter based on the input configuration
            • Apply filter request to gateway
            • Builds the filter from the request
            • Apply headers to the gateway
            • Apply a filter to the gateway
            • Creates a filter based on the incoming request
            • Applies a filter to the gateway
            • This filter should only be called once
            • Apply filters to headers
            • Extracts the CUSTOM status codes from the exchange
            • Returns a new instance with all forwarded headers except the forwarded headers
            • Filters the response based on the status code
            • Returns the route definitions
            • Applies the filter to the request
            • Filters the incoming headers from the exchange
            • Determines if the Redis rate limit is allowed or not
            • List of routes
            Get all kandi verified functions for this library.

            spring-cloud-gateway Key Features

            No Key Features are available at this moment for spring-cloud-gateway.

            spring-cloud-gateway Examples and Code Snippets

            No Code Snippets are available at this moment for spring-cloud-gateway.

            Community Discussions

            QUESTION

            spring cloud gateway only forwards to base path of url
            Asked 2022-Mar-20 at 18:59

            I'm trying to build a simple api-gateway using spring-cloud-gateway. So far I understood the basic principle but I'm running in a specific Problem:

            The target url which I'm forwarding my request potentially contains zero, one or multiple path segments. Unfortunately, these path segments are ignored.

            ...

            ANSWER

            Answered 2022-Mar-20 at 18:59

            Ok, I found the answer: According to here it is intentional, that the path of the uri is ignored. So in my case, the set path filter would fix the problem:

            Source https://stackoverflow.com/questions/71545944

            QUESTION

            implementation of Gateway Global filter in Kotlin to Java implementation
            Asked 2022-Mar-04 at 09:36

            I have a scenario that I have some microservices, cloud gateway and eureka server. All microservices and cloud gateway registered on the eureka server. Cloud gateway will securing all the downstream services. When any user want to access the service first it will fill out the username and password for authentication on the cloud gateway. If the user will be authentic then it will access the service by the gateway route that is already set in application.properties file but I want when the user will authentic and access the service then I can also get user authentic credential in downstream services or microservices that are behind the cloud gateway. In other word I want to getting principle values that is set on the gateway in downstream service. So, After searching many days I got a Global Filter Implementation link but this filter code in Kotlin and I am not familiar with Kotlin, So unable to understand of this. I want to implement this in Java. Basically this filter for adding username and user roles to headers of downstream services request. How can I convert this filter into java.

            Here is the Workflow

            Here is the cloud gateway configuration

            ...

            ANSWER

            Answered 2022-Mar-04 at 09:36

            I believe it's something like following

            Source https://stackoverflow.com/questions/71347278

            QUESTION

            Disable OPTIONS request before POST in React
            Asked 2022-Feb-02 at 23:03

            I have a React application based on Typescript which is hosted on my PC. I use Spring gateway to forward requests to another microservice. GET requests are working fine but for POST requests I get:

            Access to XMLHttpRequest at 'http://1.1.1.1:8080/api/support/tickets/create' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

            I'm hitting this Spring Cloud Gateway issue: https://github.com/spring-cloud/spring-cloud-gateway/issues/229

            Spring cloud configuration:

            ...

            ANSWER

            Answered 2022-Jan-31 at 06:44

            It seems that your issue is about local development only.

            Create react app solves precisely this by supporting the dev server to serve as a proxy to your API endpoint.

            Just add the API domain in the proxy key in package.json. More on this here

            For production you should either host them both under the same domain (using a reverse proxy to route static content vs api request based on the URL path), or find a permanent cors friendly solution on your backend.

            Cors is a browser feature and cannot be disabled. Though, when not using the POST method you can get around the preflight but you still can't access the response body without the proper headers set

            Source https://stackoverflow.com/questions/70637808

            QUESTION

            500 Internal Server Error in redirect-uri request Webflux + OAuth2.0
            Asked 2022-Jan-27 at 11:29

            I'm trying to set up security for Webflux with OAuth2 to use it as a gateway. On the other hand I have my own Authorization Server. We can say that this is the structure I want to achieve:

            The configuration is as follows:

            WebFluxSecurityConfig.java

            ...

            ANSWER

            Answered 2022-Jan-27 at 11:29

            The problem was occurring because the default authentication manager wasn't working for me, I had to implement one specifically for my problem.

            Source https://stackoverflow.com/questions/70758560

            QUESTION

            Disable OPTIONS request before POST and DELETE requests
            Asked 2022-Jan-11 at 23:10

            I have a React application based on Typescript which is hosted on my PC. I use Spring gateway to forward requests to another microservice. GET requests are working fine but for POST requests I get:

            ...

            ANSWER

            Answered 2022-Jan-09 at 02:12

            OPTIONS pre-flight request is related to CORS policy and it is sent by the Browser automatically, so you can not disable it.

            If you have access to the Server code, you can add Access-Control-Allow-Origin: YOUR_DOMAIN header in the response message.

            You can check here how to configure CORS in Spring Cloud Gateway.

            Source https://stackoverflow.com/questions/70473973

            QUESTION

            How to load balance requests to all application pods when using Spring Cloud Gateway
            Asked 2022-Jan-07 at 11:10

            I've deployed an application in Kubernetes with two pods. If I directly invoke its Kubernetes service (http://app:8080) it will balance the requests between those two pods using round robin.

            The actual runtime contains a Spring Cloud Gateway pod in front of the application, configured this way:

            ...

            ANSWER

            Answered 2022-Jan-07 at 11:10

            In order to make Spring Cloud Gateway distribute the load and not stick to one pod I had to:

            1. Use lb:// instead of http:// in the gateway URIs.
            2. Add the following dependencies:

            Source https://stackoverflow.com/questions/70590120

            QUESTION

            How to prevent springboot gateway to forward to last element in the chain
            Asked 2021-Nov-29 at 16:00

            I am using springboot gateway for load balancing requests between my microservice

            ...

            ANSWER

            Answered 2021-Nov-29 at 16:00

            You don't have any predicate specified for your route definitions - which means both of them match any incoming request. From Spring Cloud Gateway:

            Clients make requests to Spring Cloud Gateway. If the Gateway Handler Mapping determines that a request matches a Route, it is sent to the Gateway Web Handler.

            and

            Route: Route the basic building block of the gateway. It is defined by an ID, a destination URI, a collection of predicates and a collection of filters. A route is matched if aggregate predicate is true.

            Since you don't have any predicate specified - your route matches the incoming request and the last one is winning.

            Source https://stackoverflow.com/questions/70157280

            QUESTION

            Spring cloud gateway 2.5 with eureka return 404
            Asked 2021-Nov-11 at 14:53

            I'm trying to build a gateway with load balancer by using spring-cloud-gateway But when I hit gateway, it gives me 404 instead of routing me to the registered service in eureka

            I don't want to use auto-discover feature, so I use manual routing instead.

            my code is uploaded here : https://github.com/gry77/poc-spring-cloud-gateway

            How can I fix it ?

            ...

            ANSWER

            Answered 2021-Nov-02 at 12:58

            Got answer from github, I must include ReWritePath to get it works

            Source https://stackoverflow.com/questions/69564959

            QUESTION

            java.lang.IllegalArgumentException: Unable to find GatewayFilterFactory with name JwtAuthenticationFilterGatewayFilterFactory
            Asked 2021-Sep-21 at 09:57

            I am using spring gateway implementation "org.springframework.cloud:spring-cloud-starter-gateway" as my project gateway, define the filter in application.properties like this:

            ...

            ANSWER

            Answered 2021-Sep-21 at 09:57

            if implement GatewayFilter, you should register the filter like this:

            Source https://stackoverflow.com/questions/69244460

            QUESTION

            Spring Cloud Gateway Pass Client Certificate Information
            Asked 2021-Aug-24 at 12:39

            I am trying to forward client certificate information from Spring Cloud Gateway to microservices behind it. I modified the Netty config and it is successfully requesting a client cert from the client, but I don't see it forwarding it to the microservice behind it. In Apache we used to use +ExportCertData which populated a handful of headers with the client certificate DN, validity time, etc. Does Spring Cloud Gateway have any out of the box functionality like this?

            I found these 2 questions which seem similar, but neither had very explicit answers. spring cloud gateway forward client certificate and Does anyone have a simple example of implementing x509 mutual authentication in Spring Cloud Gateway/Spring WebFlux?

            ...

            ANSWER

            Answered 2021-Aug-24 at 12:39

            After playing with it for a while, changing something on the Netty HttpClient did not seem to be right because as far as I could tell it did not know anything about where the request came from. However I found that the filter chain had all the information I needed, so I put in a custom GlobalFilter which adds the certificate information to the header like what Apache does.

            Source https://stackoverflow.com/questions/68865665

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install spring-cloud-gateway

            In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin. The following files can be found in the Spring Cloud Build project. Go to File → Settings → Editor → Code style. There click on the icon next to the Scheme section. There, click on the Import Scheme value and pick the Intellij IDEA code style XML option. Import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml file. Go to File → Settings → Editor → Inspections. There click on the icon next to the Profile section. There, click on the Import Profile and import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml file. To have Intellij work with Checkstyle, you have to install the Checkstyle plugin. It’s advisable to also install the Assertions2Assertj to automatically convert the JUnit assertions.
            Default Checkstyle rules
            File header setup
            Default suppression rules
            Project defaults for Intellij that apply most of Checkstyle rules
            Project style conventions for Intellij that apply most of Checkstyle rules
            checkstyle.header.file - please point it to the Spring Cloud Build’s, spring-cloud-build-tools/src/main/resources/checkstyle-header.txt file either in your cloned repo or via the https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt URL.
            checkstyle.suppressions.file - default suppressions. Please point it to the Spring Cloud Build’s, spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml file either in your cloned repo or via the https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml URL.
            checkstyle.additional.suppressions.file - this variable corresponds to suppressions in your local project. E.g. you’re working on spring-cloud-contract. Then point to the project-root/src/checkstyle/checkstyle-suppressions.xml folder. Example for spring-cloud-contract would be: /home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml.

            Support

            The spring-cloud-build module has a "docs" profile, and if you switch that on it will try to build asciidoc sources from src/main/asciidoc. As part of that process it will look for a README.adoc and process it by loading all the includes, but not parsing or rendering it, just copying it to ${main.basedir} (defaults to ${basedir}, i.e. the root of the project). If there are any changes in the README it will then show up after a Maven build as a modified file in the correct place. Just commit it and push the change.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
            Maven
            Gradle
            CLONE
          • HTTPS

            https://github.com/spring-cloud/spring-cloud-gateway.git

          • CLI

            gh repo clone spring-cloud/spring-cloud-gateway

          • sshUrl

            git@github.com:spring-cloud/spring-cloud-gateway.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link