<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>http://rasimsen.com/index.php?action=history&amp;feed=atom&amp;title=New_Spring_Cloud_Gateway</id>
	<title>New Spring Cloud Gateway - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://rasimsen.com/index.php?action=history&amp;feed=atom&amp;title=New_Spring_Cloud_Gateway"/>
	<link rel="alternate" type="text/html" href="http://rasimsen.com/index.php?title=New_Spring_Cloud_Gateway&amp;action=history"/>
	<updated>2026-04-24T09:46:47Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>http://rasimsen.com/index.php?title=New_Spring_Cloud_Gateway&amp;diff=845&amp;oldid=prev</id>
		<title>Rasimsen: /* Host Route Predicate Factor */</title>
		<link rel="alternate" type="text/html" href="http://rasimsen.com/index.php?title=New_Spring_Cloud_Gateway&amp;diff=845&amp;oldid=prev"/>
		<updated>2018-11-28T13:56:48Z</updated>

		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Host Route Predicate Factor&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 13:56, 28 November 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l151&quot; &gt;Line 151:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 151:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;//..route definition&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;//..route definition&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;.route(r -&amp;gt; r.host(&amp;quot;**.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;baeldung&lt;/del&gt;.com&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;.route(r -&amp;gt; r.host(&amp;quot;**.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;rasimsen&lt;/ins&gt;.com&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;.id(&amp;quot;host_route&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;.id(&amp;quot;host_route&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;.uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;.uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rasimsen</name></author>
		
	</entry>
	<entry>
		<id>http://rasimsen.com/index.php?title=New_Spring_Cloud_Gateway&amp;diff=844&amp;oldid=prev</id>
		<title>Rasimsen: /* Query Route Predicate Factory */</title>
		<link rel="alternate" type="text/html" href="http://rasimsen.com/index.php?title=New_Spring_Cloud_Gateway&amp;diff=844&amp;oldid=prev"/>
		<updated>2018-11-28T13:49:27Z</updated>

		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Query Route Predicate Factory&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 13:49, 28 November 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l208&quot; &gt;Line 208:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 208:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; routes:&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; routes:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; - id: query_route&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; - id: query_route&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; uri: http://&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;baeldung&lt;/del&gt;.com&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; uri: http://&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;rasimsen&lt;/ins&gt;.com&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; predicates:&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; predicates:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; - Query=articleId, \w&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; - Query=articleId, \w&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rasimsen</name></author>
		
	</entry>
	<entry>
		<id>http://rasimsen.com/index.php?title=New_Spring_Cloud_Gateway&amp;diff=843&amp;oldid=prev</id>
		<title>Rasimsen at 13:46, 28 November 2018</title>
		<link rel="alternate" type="text/html" href="http://rasimsen.com/index.php?title=New_Spring_Cloud_Gateway&amp;diff=843&amp;oldid=prev"/>
		<updated>2018-11-28T13:46:11Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 13:46, 28 November 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l540&quot; &gt;Line 540:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 540:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;We see that the relative url: “/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;baeldung” &lt;/del&gt;is configured as a route, so hitting the url “http://localhost/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;baeldung” &lt;/del&gt;we’ll be redirected to “http://&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;baeldung&lt;/del&gt;.com“, as was configured in our example.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;We see that the relative url: “/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;rasimsen” &lt;/ins&gt;is configured as a route, so hitting the url “http://localhost/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;rasimsen” &lt;/ins&gt;we’ll be redirected to “http://&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;rasimsen&lt;/ins&gt;.com“, as was configured in our example.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Conclusion=&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Conclusion=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rasimsen</name></author>
		
	</entry>
	<entry>
		<id>http://rasimsen.com/index.php?title=New_Spring_Cloud_Gateway&amp;diff=842&amp;oldid=prev</id>
		<title>Rasimsen: Created page with &quot;= Overview= In this article, we’ll explore the main features of the Spring Cloud Gateway project, a new API based on Spring 5, Spring Boot 2 and Project Reactor.  The tool p...&quot;</title>
		<link rel="alternate" type="text/html" href="http://rasimsen.com/index.php?title=New_Spring_Cloud_Gateway&amp;diff=842&amp;oldid=prev"/>
		<updated>2018-11-28T13:43:37Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= Overview= In this article, we’ll explore the main features of the Spring Cloud Gateway project, a new API based on Spring 5, Spring Boot 2 and Project Reactor.  The tool p...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Overview=&lt;br /&gt;
In this article, we’ll explore the main features of the Spring Cloud Gateway project, a new API based on Spring 5, Spring Boot 2 and Project Reactor.&lt;br /&gt;
&lt;br /&gt;
The tool provides out-of-the-box routing mechanisms often used in microservices applications as a way of hiding multiple services behind a single facade.&lt;br /&gt;
&lt;br /&gt;
For an explanation of the Gateway pattern without the Spring Cloud Gateway project, check out our previous article.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Routing Handler=&lt;br /&gt;
Being focused on routing requests, the Spring Cloud Gateway forwards requests to a Gateway Handler Mapping – which determines what should be done with requests matching a specific route.&lt;br /&gt;
&lt;br /&gt;
Let’s start with a quick example of how to the Gateway Handler resolves route configurations by using RouteLocator:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
@Bean&lt;br /&gt;
public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {&lt;br /&gt;
    return builder.routes()&lt;br /&gt;
      .route(&amp;quot;r1&amp;quot;, r -&amp;gt; r.host(&amp;quot;**.rasimsen.com&amp;quot;)&lt;br /&gt;
        .and()&lt;br /&gt;
        .path(&amp;quot;/rasimsen&amp;quot;)&lt;br /&gt;
        .uri(&amp;quot;http://rasimsen.com&amp;quot;))&lt;br /&gt;
      .route(r -&amp;gt; r.host(&amp;quot;**.rasimsen.com&amp;quot;)&lt;br /&gt;
        .and()&lt;br /&gt;
        .path(&amp;quot;/myOtherRouting&amp;quot;)&lt;br /&gt;
        .filters(f -&amp;gt; f.prefixPath(&amp;quot;/myPrefix&amp;quot;))&lt;br /&gt;
        .uri(&amp;quot;http://othersite.com&amp;quot;)&lt;br /&gt;
        .id(&amp;quot;myOtherID&amp;quot;))&lt;br /&gt;
    .build();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice how we made use of the main building blocks of this API:&lt;br /&gt;
&lt;br /&gt;
* Route – the primary API of the gateway. It is defined by a given identification (ID), a destination (URI) and set of predicates and filters&lt;br /&gt;
* Predicate – a Java 8’s Predicate – which is used for matching HTTP requests using headers, methods or parameters&lt;br /&gt;
* Filter – a standard Spring’s WebFilter&lt;br /&gt;
&lt;br /&gt;
=Dynamic Routing=&lt;br /&gt;
Just like Zuul, Spring Cloud Gateway provides means for routing requests to different services.&lt;br /&gt;
&lt;br /&gt;
The routing configuration can be created by using pure Java (RouteLocator, as shown in the example in section 2.1) or by using properties configuration:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  application:&lt;br /&gt;
    name: gateway-service  &lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: rasimsen&lt;br /&gt;
        uri: rasimsen.com&lt;br /&gt;
      - id: myOtherRouting&lt;br /&gt;
        uri: localhost:9999&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Routing Factories=&lt;br /&gt;
Spring Cloud Gateway matches routes using the Spring WebFlux HandlerMapping infrastructure.&lt;br /&gt;
&lt;br /&gt;
It also includes many built-in Route Predicate Factories. All of these predicates match different attributes of the HTTP request. Multiple Route Predicate Factories can be combined via the logical “and”.&lt;br /&gt;
&lt;br /&gt;
Route matching can be applied both programmatically or via configuration properties file using a different type of Route Predicate Factories.&lt;br /&gt;
&lt;br /&gt;
==Before Route Predicate Factory==&lt;br /&gt;
The Before Route Predicate Factory takes one parameter: a datetime. This predicate matches requests that happen before the current datetime:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: before_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Before=2017-09-11T17:42:47.789-07:00[America/Alaska]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Java configuration can be represented as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//..route definition&lt;br /&gt;
.route(r -&amp;gt; r.before(LocalDateTime.now().atZone(ZoneId.systemDefault())) &lt;br /&gt;
.id(&amp;quot;before_route&amp;quot;)&lt;br /&gt;
.uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Between Route Predicate Factory==&lt;br /&gt;
The Between Route Predicate Factory takes two parameters: datetime1, and datetime2. This predicate matches requests that happen after datetime1 (inclusive) and before datetime2 (exclusive). The datetime2 parameter must be after datetime1:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: between_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Between=2017-09-10T17:42:47.789-07:00[America/Alaska], 2017-09-11T17:42:47.789-07:00[America/Alaska]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the Java configuration looks like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
ZonedDateTime datetime1 = LocalDateTime.now().minusDays(1).atZone(ZoneId.systemDefault());&lt;br /&gt;
ZonedDateTime datetime2 = LocalDateTime.now().atZone(ZoneId.systemDefault())&lt;br /&gt;
//..route definition&lt;br /&gt;
.route(r -&amp;gt; r.between(datetime1, datetime2))&lt;br /&gt;
.id(&amp;quot;between_route&amp;quot;)&lt;br /&gt;
.uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Header Route Predicate Factory==&lt;br /&gt;
&lt;br /&gt;
The Header Route Predicate Factory takes two parameters: the header name, and a regular expression. This predicate matches a header matching the regular expression:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: header_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Header=X-Request-Id, \d+&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Java configuration can be represented as:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//..route definition&lt;br /&gt;
.route(r -&amp;gt; r.header(&amp;quot;X-Request-Id&amp;quot;, &amp;quot;\\d+&amp;quot;)&lt;br /&gt;
.id(&amp;quot;header_route&amp;quot;)&lt;br /&gt;
.uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Host Route Predicate Factor==&lt;br /&gt;
The Host Route Predicate Factory takes one parameter: the hostname pattern. The pattern is an Ant-style pattern with “.” as the separator.&lt;br /&gt;
&lt;br /&gt;
This predicate matches the Host header with the given the pattern:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: host_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Host=**.rasimsen.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here’s the Java configuration alternative:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//..route definition&lt;br /&gt;
.route(r -&amp;gt; r.host(&amp;quot;**.baeldung.com&amp;quot;)&lt;br /&gt;
.id(&amp;quot;host_route&amp;quot;)&lt;br /&gt;
.uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Method Route Predicate Factory==&lt;br /&gt;
The Method Route Predicate Factory takes one parameter: the HTTP method to match:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: method_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Method=GET&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Java configuration can be represented as:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//..route definition&lt;br /&gt;
.route(r -&amp;gt; r.method(&amp;quot;GET&amp;quot;)&lt;br /&gt;
.id(&amp;quot;method_route&amp;quot;)&lt;br /&gt;
.uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Path Route Predicate Factory==&lt;br /&gt;
The Path Route Predicate Factory takes one parameter: a Spring PathMatcher pattern:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: path_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Path=/articles/{articleId}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Java configuration:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//..route definition&lt;br /&gt;
.route(r -&amp;gt; r.path(&amp;quot;/articles/&amp;quot;+articleId)&lt;br /&gt;
.id(&amp;quot;path_route&amp;quot;)&lt;br /&gt;
.uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Query Route Predicate Factory==&lt;br /&gt;
The Query Route Predicate Factory takes two parameters: a required param and an optional regexp:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: query_route&lt;br /&gt;
        uri: http://baeldung.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Query=articleId, \w&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the Java configuration:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//..route definition&lt;br /&gt;
.route(r -&amp;gt; r.query(&amp;quot;articleId&amp;quot;, &amp;quot;\w&amp;quot;)&lt;br /&gt;
.id(&amp;quot;query_route&amp;quot;)&lt;br /&gt;
.uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RemoteAddr Route Predicate Factory==&lt;br /&gt;
The RemoteAddr Route Predicate Factory takes a list (minimum of 1) of CIDR-notation strings, e.g., 192.168.0.1/16 (where 192.168.0.1 is an IP address, and 16 is a subnet mask):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: remoteaddr_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - RemoteAddr=192.168.1.1/24&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the corresponding Java configuration:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//..route definition&lt;br /&gt;
.route(r -&amp;gt; r.remoteAddr(&amp;quot;192.168.1.1/24&amp;quot;)&lt;br /&gt;
.id(&amp;quot;remoteaddr_route&amp;quot;)&lt;br /&gt;
.uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=WebFilter Factories=&lt;br /&gt;
Route filters make the modification of the incoming HTTP request or outgoing HTTP response possible.&lt;br /&gt;
&lt;br /&gt;
Spring Cloud Gateway includes many built-in WebFilter Factories.&lt;br /&gt;
&lt;br /&gt;
==AddRequestHeader WebFilter Factory==&lt;br /&gt;
The AddRequestHeader WebFilter Factory takes a name and value parameter:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: addrequestheader_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Path=/articles&lt;br /&gt;
        filters:&lt;br /&gt;
        - AddRequestHeader=X-SomeHeader, bael&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here’s the corresponding Java config:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//...route definition&lt;br /&gt;
.route(r -&amp;gt; r.path(&amp;quot;/articles&amp;quot;)&lt;br /&gt;
  .filters(f -&amp;gt; f.addRequestHeader(&amp;quot;X-TestHeader&amp;quot;, &amp;quot;rewrite_request&amp;quot;))&lt;br /&gt;
  .uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
  .id(&amp;quot;addrequestheader_route&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AddRequestParameter WebFilter Factory==&lt;br /&gt;
The AddRequestParameter WebFilter Factory takes a name and value parameter:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: addrequestparameter_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Path=/articles&lt;br /&gt;
        filters:&lt;br /&gt;
        - AddRequestParameter=foo, bar&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corresponding Java configuration:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//...route definition&lt;br /&gt;
.route(r -&amp;gt; r.path(&amp;quot;/articles&amp;quot;)&lt;br /&gt;
  .filters(f -&amp;gt; f.addRequestParameter(&amp;quot;foo&amp;quot;, &amp;quot;bar&amp;quot;))&lt;br /&gt;
  .uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
  .id(&amp;quot;addrequestparameter_route&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AddResponseHeader WebFilter Factory==&lt;br /&gt;
&lt;br /&gt;
The AddResponseHeader WebFilter Factory takes a name and value parameter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: addrequestheader_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Path=/articles&lt;br /&gt;
        filters:&lt;br /&gt;
        - AddResponseHeader=X-SomeHeader, Bar&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corresponding Java configuration:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//...route definition&lt;br /&gt;
.route(r -&amp;gt; r.path(&amp;quot;/articles&amp;quot;)&lt;br /&gt;
  .filters(f -&amp;gt; f.addResponseHeader(&amp;quot;X-SomeHeader&amp;quot;, &amp;quot;Bar&amp;quot;))&lt;br /&gt;
  .uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
  .id(&amp;quot;addresponseheader_route&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Circuit Breaker WebFilter Factory==&lt;br /&gt;
&lt;br /&gt;
Hystrix is used as Circuit-Breaker WebFilter Factory and takes a single name parameter, which is the name of the Hystrix command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: hystrix_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Path=/articles&lt;br /&gt;
        filters:&lt;br /&gt;
        - Hystrix=someCommand&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The corresponding Java configuration:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//...route definition&lt;br /&gt;
.route(r -&amp;gt; r.path(&amp;quot;/articles&amp;quot;)&lt;br /&gt;
  .filters(f -&amp;gt; f.hystrix(&amp;quot;some-command&amp;quot;))&lt;br /&gt;
  .uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
  .id(&amp;quot;hystrix_route&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RedirectTo WebFilter Factory==&lt;br /&gt;
The RedirectTo WebFilter Factory takes a status and a URL parameter. The status should be a 300 redirect HTTP code, such as 301:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: redirectto_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Path=/articles&lt;br /&gt;
        filters:&lt;br /&gt;
        - RedirectTo=302, http://foo.bar&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the corresponding Java configuration:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//...route definition&lt;br /&gt;
.route(r -&amp;gt; r.path(&amp;quot;/articles&amp;quot;)&lt;br /&gt;
  .filters(f -&amp;gt; f.redirect(&amp;quot;302&amp;quot;,&amp;quot;http://foo.bar&amp;quot;))&lt;br /&gt;
  .uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
  .id(&amp;quot;redirectto_route&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RewritePath WebFilter Factory==&lt;br /&gt;
The RewritePath WebFilter Factory takes a path regexp parameter and a replacement parameter. This uses Java regular expressions to rewrite the request path.&lt;br /&gt;
&lt;br /&gt;
Here is a configuration example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: rewritepath_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates: &lt;br /&gt;
        - Path=/articles/**&lt;br /&gt;
        filters:&lt;br /&gt;
        - RewritePath=/articles/(?&amp;lt;articleId&amp;gt;.*), /$\{articleId}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Java configuration can be represented as:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//...route definition&lt;br /&gt;
.route(r -&amp;gt; r.path(&amp;quot;/articles&amp;quot;)&lt;br /&gt;
  .filters(f -&amp;gt; f.rewritePath(&amp;quot;(?&amp;lt;articleId&amp;gt;.*)&amp;quot;, articleId))&lt;br /&gt;
  .uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
  .id(&amp;quot;rewritepath_route&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RequestRateLimiter WebFilter Factory==&lt;br /&gt;
The RequestRateLimiter WebFilter Factory takes three parameters: replenishRate, capacity, and keyResolverName.&lt;br /&gt;
&lt;br /&gt;
* replenishRate – represents how many requests per second do you want a user to be allowed to do&lt;br /&gt;
* capacity – defines how much bursting capacity would be allowed&lt;br /&gt;
* keyResolverName – is the name of a bean that implements the KeyResolver interface&lt;br /&gt;
&lt;br /&gt;
The KeyResolver interface allows pluggable strategies to derive the key for limiting requests:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: requestratelimiter_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Path=/articles&lt;br /&gt;
        filters:&lt;br /&gt;
        - RequestRateLimiter=10, 50, userKeyResolver&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The Java configuration can be represented as:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//...route definition&lt;br /&gt;
.route(r -&amp;gt; r.path(&amp;quot;/articles&amp;quot;)&lt;br /&gt;
  .filters(f -&amp;gt; f.requestRateLimiter().configure(c -&amp;gt; c.setRateLimiter(myRateLimiter)))&lt;br /&gt;
  .uri(&amp;quot;http://rasimsen.com&amp;quot;)&lt;br /&gt;
  .id(&amp;quot;requestratelimiter_route&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Spring Cloud DiscoveryClient Support=&lt;br /&gt;
Spring Cloud Gateway can be easily integrated with Service Discovery and Registry libraries, such as Eureka Server and Consul:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
@Configuration&lt;br /&gt;
@EnableDiscoveryClient&lt;br /&gt;
public class GatewayDiscoveryConfiguration {&lt;br /&gt;
  &lt;br /&gt;
    @Bean&lt;br /&gt;
    public DiscoveryClientRouteDefinitionLocator &lt;br /&gt;
      discoveryClientRouteLocator(DiscoveryClient discoveryClient) {&lt;br /&gt;
  &lt;br /&gt;
        return new DiscoveryClientRouteDefinitionLocator(discoveryClient);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LoadBalancerClient Filter==&lt;br /&gt;
The LoadBalancerClientFilter looks for a URI in the exchange attribute property using ServerWebExchangeUtils.GATEWAY_REQUEST_URL_ATTR.&lt;br /&gt;
&lt;br /&gt;
If the URL has a lb scheme (e.g., lb://rasimsen-service) it’ll use the Spring Cloud LoadBalancerClient to resolve the name (i.e., rasimsen-service) to an actual host and port.&lt;br /&gt;
&lt;br /&gt;
The unmodified original URL is placed in the ServerWebExchangeUtils.GATEWAY_ORIGINAL_REQUEST_URL_ATTR attribute.&lt;br /&gt;
&lt;br /&gt;
= Monitoring=&lt;br /&gt;
Spring Cloud Gateway makes use of the Actuator API, a well-known Spring-Boot library that provides several out-of-the-box services for monitoring the application.&lt;br /&gt;
&lt;br /&gt;
Once the Actuator API is installed and configured, the gateway monitoring features can be visualized by accessing /gateway/ endpoint.&lt;br /&gt;
&lt;br /&gt;
=Implementation=&lt;br /&gt;
&lt;br /&gt;
We’ll now create a simple example of the usage of Spring Cloud Gateway as a proxy server using the path predicate.&lt;br /&gt;
== Dependencies==&lt;br /&gt;
The Spring Cloud Gateway is currently in the milestones repository, on version 2.0.0.RC2. This is also the version we’re using here.&lt;br /&gt;
&lt;br /&gt;
To add the project, we’ll use the dependency management system:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;dependencyManagement&amp;gt;&lt;br /&gt;
    &amp;lt;dependencies&amp;gt;&lt;br /&gt;
        &amp;lt;dependency&amp;gt;&lt;br /&gt;
            &amp;lt;groupId&amp;gt;org.springframework.cloud&amp;lt;/groupId&amp;gt;&lt;br /&gt;
            &amp;lt;artifactId&amp;gt;spring-cloud-gateway&amp;lt;/artifactId&amp;gt;&lt;br /&gt;
            &amp;lt;version&amp;gt;2.0.0.RC2&amp;lt;/version&amp;gt;&lt;br /&gt;
            &amp;lt;type&amp;gt;pom&amp;lt;/type&amp;gt;&lt;br /&gt;
            &amp;lt;scope&amp;gt;import&amp;lt;/scope&amp;gt;&lt;br /&gt;
        &amp;lt;/dependency&amp;gt;&lt;br /&gt;
    &amp;lt;/dependencies&amp;gt;&lt;br /&gt;
&amp;lt;/dependencyManagement&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we’ll add the necessary dependencies:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;dependency&amp;gt;&lt;br /&gt;
    &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;&lt;br /&gt;
    &amp;lt;artifactId&amp;gt;spring-boot-actuator&amp;lt;/artifactId&amp;gt;&lt;br /&gt;
&amp;lt;/dependency&amp;gt;&lt;br /&gt;
&amp;lt;dependency&amp;gt;&lt;br /&gt;
    &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;&lt;br /&gt;
    &amp;lt;artifactId&amp;gt;spring-boot-starter-webflux&amp;lt;/artifactId&amp;gt;&lt;br /&gt;
&amp;lt;/dependency&amp;gt;&lt;br /&gt;
&amp;lt;dependency&amp;gt;&lt;br /&gt;
    &amp;lt;groupId&amp;gt;org.springframework.cloud&amp;lt;/groupId&amp;gt;&lt;br /&gt;
    &amp;lt;artifactId&amp;gt;spring-cloud-starter-gateway&amp;lt;/artifactId&amp;gt;&lt;br /&gt;
&amp;lt;/dependency&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Code Implementation==&lt;br /&gt;
And now we create a simple routing configuration in the application.yml file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
spring:&lt;br /&gt;
  cloud:&lt;br /&gt;
    gateway:&lt;br /&gt;
      routes:&lt;br /&gt;
      - id: rasimsen_route&lt;br /&gt;
        uri: http://rasimsen.com&lt;br /&gt;
        predicates:&lt;br /&gt;
        - Path=/rasimsen/&lt;br /&gt;
management:&lt;br /&gt;
  endpoints:&lt;br /&gt;
    web:&lt;br /&gt;
      exposure:&lt;br /&gt;
        include: &amp;quot;*&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
And the Gateway application code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
@SpringBootApplication&lt;br /&gt;
public class GatewayApplication {&lt;br /&gt;
    public static void main(String[] args) {&lt;br /&gt;
        SpringApplication.run(GatewayApplication.class, args);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After the application starts, we can access the url: “http://localhost/actuator/gateway/routes/baeldung_route” to check all routing configuration created:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;id&amp;quot;:&amp;quot;rasimsen_route&amp;quot;,&lt;br /&gt;
    &amp;quot;predicates&amp;quot;:[{&lt;br /&gt;
        &amp;quot;name&amp;quot;:&amp;quot;Path&amp;quot;,&lt;br /&gt;
        &amp;quot;args&amp;quot;:{&amp;quot;_genkey_0&amp;quot;:&amp;quot;/rasimsen&amp;quot;}&lt;br /&gt;
    }],&lt;br /&gt;
    &amp;quot;filters&amp;quot;:[],&lt;br /&gt;
    &amp;quot;uri&amp;quot;:&amp;quot;http://rasimsen.com&amp;quot;,&lt;br /&gt;
    &amp;quot;order&amp;quot;:0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We see that the relative url: “/baeldung” is configured as a route, so hitting the url “http://localhost/baeldung” we’ll be redirected to “http://baeldung.com“, as was configured in our example.&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
In this article, we explored some of the features and components that are part of Spring Cloud Gateway. This new API provides out-of-the-box tools for gateway and proxy support.&lt;br /&gt;
&lt;br /&gt;
source: https://www.baeldung.com/spring-cloud-gateway&lt;/div&gt;</summary>
		<author><name>Rasimsen</name></author>
		
	</entry>
</feed>