Sync docs from master to gh-pages
This commit is contained in:
@@ -44,4 +44,20 @@
|
||||
)
|
||||
.build();
|
||||
}</pre><p>
|
||||
</p><p>This style also allows for more custom predicate assertions. The predicates defined by <code class="literal">RouteDefinitionLocator</code> beans are combined using logical <code class="literal">and</code>. By using the fluent Java API, you can use the <code class="literal">and()</code>, <code class="literal">or()</code> and <code class="literal">negate()</code> operators on the <code class="literal">Predicate</code> class.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_discoveryclient_route_definition_locator" href="#_discoveryclient_route_definition_locator"></a>8.2 DiscoveryClient Route Definition Locator</h2></div></div></div><p>The Gateway can be configured to create routes based on services registered with a <code class="literal">DiscoveryClient</code> compatible service registry.</p><p>To enable this, set <code class="literal">spring.cloud.gateway.discovery.locator.enabled=true</code> and make sure a <code class="literal">DiscoveryClient</code> implementation is on the classpath and enabled (such as Netflix Eureka, Consul or Zookeeper).</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__tls_ssl.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__reactor_netty_access_logs.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">7. TLS / SSL </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-gateway.html">Home</a></td><td width="40%" align="right" valign="top"> 9. Reactor Netty Access Logs</td></tr></table></div></body></html>
|
||||
</p><p>This style also allows for more custom predicate assertions. The predicates defined by <code class="literal">RouteDefinitionLocator</code> beans are combined using logical <code class="literal">and</code>. By using the fluent Java API, you can use the <code class="literal">and()</code>, <code class="literal">or()</code> and <code class="literal">negate()</code> operators on the <code class="literal">Predicate</code> class.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_discoveryclient_route_definition_locator" href="#_discoveryclient_route_definition_locator"></a>8.2 DiscoveryClient Route Definition Locator</h2></div></div></div><p>The Gateway can be configured to create routes based on services registered with a <code class="literal">DiscoveryClient</code> compatible service registry.</p><p>To enable this, set <code class="literal">spring.cloud.gateway.discovery.locator.enabled=true</code> and make sure a <code class="literal">DiscoveryClient</code> implementation is on the classpath and enabled (such as Netflix Eureka, Consul or Zookeeper).</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_configuring_predicates_and_filters_for_discoveryclient_routes" href="#_configuring_predicates_and_filters_for_discoveryclient_routes"></a>8.2.1 Configuring Predicates and Filters For DiscoveryClient Routes</h3></div></div></div><p>By default the Gateway defines a single predicate and filter for routes created via a <code class="literal">DiscoveryClient</code>.</p><p>The default predicate is a path predicate defined with the pattern <code class="literal">/serviceId/**</code>, where <code class="literal">serviceId</code> is
|
||||
the id of the service from the <code class="literal">DiscoveryClient</code>.</p><p>The default filter is rewrite path filter with the regex <code class="literal">/serviceId/(?<remaining>.*)</code> and the replacement
|
||||
<code class="literal">/${remaining}</code>. This just strips the service id from the path before the request is sent
|
||||
downstream.</p><p>If you would like to customize the predicates and/or filters used by the <code class="literal">DiscoveryClient</code> routes you can do so
|
||||
by setting <code class="literal">spring.cloud.gateway.discovery.locator.predicates[x]</code> and <code class="literal">spring.cloud.gateway.discovery.locator.filters[y]</code>.
|
||||
When doing so you need to make sure to include the default predicate and filter above, if you want to retain
|
||||
that functionality. Below is an example of what this looks like.</p><p><b>application.properties. </b>
|
||||
</p><pre class="screen">spring.cloud.gateway.discovery.locator.predicates[0].name: Path
|
||||
spring.cloud.gateway.discovery.locator.predicates[0].args[pattern]: "'/'+serviceId+'/**'"
|
||||
spring.cloud.gateway.discovery.locator.predicates[1].name: Host
|
||||
spring.cloud.gateway.discovery.locator.predicates[1].args[pattern]: "'**.foo.com'"
|
||||
spring.cloud.gateway.discovery.locator.filters[0].name: Hystrix
|
||||
spring.cloud.gateway.discovery.locator.filters[0].args[name]: serviceId
|
||||
spring.cloud.gateway.discovery.locator.filters[1].name: RewritePath
|
||||
spring.cloud.gateway.discovery.locator.filters[1].args[regexp]: "'/' + serviceId + '/(?<remaining>.*)'"
|
||||
spring.cloud.gateway.discovery.locator.filters[1].args[replacement]: "'/${remaining}'"</pre><p>
|
||||
</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__tls_ssl.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__reactor_netty_access_logs.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">7. TLS / SSL </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-gateway.html">Home</a></td><td width="40%" align="right" valign="top"> 9. Reactor Netty Access Logs</td></tr></table></div></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1302,6 +1302,33 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder, ThrottleGate
|
||||
<title>DiscoveryClient Route Definition Locator</title>
|
||||
<simpara>The Gateway can be configured to create routes based on services registered with a <literal>DiscoveryClient</literal> compatible service registry.</simpara>
|
||||
<simpara>To enable this, set <literal>spring.cloud.gateway.discovery.locator.enabled=true</literal> and make sure a <literal>DiscoveryClient</literal> implementation is on the classpath and enabled (such as Netflix Eureka, Consul or Zookeeper).</simpara>
|
||||
<section xml:id="_configuring_predicates_and_filters_for_discoveryclient_routes">
|
||||
<title>Configuring Predicates and Filters For DiscoveryClient Routes</title>
|
||||
<simpara>By default the Gateway defines a single predicate and filter for routes created via a <literal>DiscoveryClient</literal>.</simpara>
|
||||
<simpara>The default predicate is a path predicate defined with the pattern <literal>/serviceId/**</literal>, where <literal>serviceId</literal> is
|
||||
the id of the service from the <literal>DiscoveryClient</literal>.</simpara>
|
||||
<simpara>The default filter is rewrite path filter with the regex <literal>/serviceId/(?<remaining>.*)</literal> and the replacement
|
||||
<literal>/${remaining}</literal>. This just strips the service id from the path before the request is sent
|
||||
downstream.</simpara>
|
||||
<simpara>If you would like to customize the predicates and/or filters used by the <literal>DiscoveryClient</literal> routes you can do so
|
||||
by setting <literal>spring.cloud.gateway.discovery.locator.predicates[x]</literal> and <literal>spring.cloud.gateway.discovery.locator.filters[y]</literal>.
|
||||
When doing so you need to make sure to include the default predicate and filter above, if you want to retain
|
||||
that functionality. Below is an example of what this looks like.</simpara>
|
||||
<formalpara>
|
||||
<title>application.properties</title>
|
||||
<para>
|
||||
<screen>spring.cloud.gateway.discovery.locator.predicates[0].name: Path
|
||||
spring.cloud.gateway.discovery.locator.predicates[0].args[pattern]: "'/'+serviceId+'/**'"
|
||||
spring.cloud.gateway.discovery.locator.predicates[1].name: Host
|
||||
spring.cloud.gateway.discovery.locator.predicates[1].args[pattern]: "'**.foo.com'"
|
||||
spring.cloud.gateway.discovery.locator.filters[0].name: Hystrix
|
||||
spring.cloud.gateway.discovery.locator.filters[0].args[name]: serviceId
|
||||
spring.cloud.gateway.discovery.locator.filters[1].name: RewritePath
|
||||
spring.cloud.gateway.discovery.locator.filters[1].args[regexp]: "'/' + serviceId + '/(?<remaining>.*)'"
|
||||
spring.cloud.gateway.discovery.locator.filters[1].args[replacement]: "'/${remaining}'"</screen>
|
||||
</para>
|
||||
</formalpara>
|
||||
</section>
|
||||
</section>
|
||||
</chapter>
|
||||
<chapter xml:id="_reactor_netty_access_logs">
|
||||
|
||||
Reference in New Issue
Block a user