Commit Graph

226 Commits

Author SHA1 Message Date
Dave Syer
0391cfff65 Allow streaming of multipart requests in Zuul proxy
It turns out that the suckiness of Zuul with multipart requests
comes almost entirely from the Multipart handling in Spring's
DispatcherServlet. This change makes the proxy routes available
on an alternative path /zuul/<normal_path> (where
/zuul is the default value of zuul.servletPath). I have
tested those with 800MB file uploads using the main method in
the FormZuulServletProxyApplicationTests and the main
observation is that there is no OutOfMemory error (no-one tries
to download the complete request body). It works with Ribbon
and with the simple (HttpClient) filter. With Ribbon you
will need to set some timeouts if you want to upload files
as large as that, e.g. see application.yml in the tests:

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 60000
ribbon:
  ConnectTimeout: 3000
  ReadTimeout: 60000

You need to set "Transfer-Encoding: chunked" in the
incoming request. Chrome does not do this by default
apparently, but I was able to test with curl, e.g.

$ curl -v -H "Transfer-Encoding: chunked" \
  -F "file=@mylarg.iso" \
  localhost:9999/zuul/direct/file

The old proxy paths through the DispatcherServlet are still
available (for backwards compatibility and for convenience of
having the paths available at the root of the context path).

Fixes gh-254
2015-03-13 16:55:30 +00:00
Dave Syer
da4f5d3454 Fix issue with servlet request wrappers in Zuul
Because of the way that a FormBodyServletRequestWrapper was
implemented (extending the Zuul servlet 2.5 wrapper) it could
barf at runtime if anyone called its servlet 3.0 methods. The fix
for that was to extract our Servlet30RequestWrapper and extend that
instead.

Also tweaked the DebugFilter a bit so it doesn't try and display
the whole payload. Probably speeds up file uploads a bit but the
fact that we have to store the whole request body in memory is
going to kill us eventually.

See gh-254
2015-03-13 13:07:33 +00:00
Spencer Gibb
e2583f5380 upgrade Ribbon to version 2.0.0.
From 2.0.RC13

fixes gh-216
2015-03-06 12:47:27 -07:00
Spencer Gibb
384fad6c40 wrap SpringLBClientFactory in a CachingLBClientFactory so LBClients are reused.
fixes gh-240
2015-03-05 12:39:22 -07:00
Spencer Gibb
4bd7c3bdcf upgrade feign to 7.3.0
fixes gh-243
2015-03-05 11:42:09 -07:00
Spencer Gibb
7b6f14805d return null for choose() rather than throw an illegal argument exception.
fixes gh-236
2015-03-02 09:44:11 -07:00
Dave Syer
2d35ae1632 Back to configure->config 2015-02-27 15:23:51 +00:00
Dave Syer
a954e88fc6 Config package name change 2015-02-25 17:12:50 +00:00
Dave Syer
e096fd8e05 Move RibbonInterceptor into commons
It didn't depend on Ribbon at all so it can live in the commons
project.
2015-02-25 14:58:36 +00:00
Dave Syer
0b8f85529c Refresh health indicator for config server if present
Listen for heartbeats from discovery so that state changes can trigger
a new status (and the client doesn't rely on the old address of the
server if it has now changed).

Fixes gh-232
2015-02-25 09:17:40 +00:00
Spencer Gibb
dafb5ecf09 only set EurekaInstanceConfigBean.nonSecurePort in EurekaClientAutoConfiguration
fixes gh-225
2015-02-23 11:57:32 -07:00
Dave Syer
8b81eb8b2c Tweak autoconfig for feign
It doesn't make sense to @EnableFeignClients in autoconfig
because the user needs to specify a package to scan. It does
make sense (sort of) to set up the encoder/decoder/logger etc.

See gh-226
2015-02-23 17:23:05 +00:00
Dave Syer
1d35804831 Retain scheme (e.g. https) in URL from @FeignClient
When the URL is passed down to Ribbon and reconstructed from
a LoadBalancer the Server only knows about host and port, so the scheme
has to come from the original declaration.

There's still a potential problem with Eureka remote services that
are available with a non-secure port as well (probably fairly rare).

Fixes gh-221
2015-02-23 10:02:51 +00:00
Spencer Gibb
572f97e135 remove getAllInstances 2015-02-13 13:30:25 -07:00
Spencer Gibb
f49d99ef5b Pass LB IClientConfig to executeWithLoadBalancer
fixes 208
2015-02-13 12:33:01 -07:00
Spencer Gibb
149cc7d760 Implement ServiceInstance.{getUri,isSecure}
fixes gh-210
2015-02-13 11:29:59 -07:00
Dave Syer
043732aef3 More careful handling of multipart data in proxy
To write file data the message converter needs the file content
to be provided in the form of an HttpEntity per file.

Fixes gh-197 again
2015-02-12 18:37:54 +00:00
Spencer Gibb
24a06ca630 only update route location if location is empty. Fixes bug introduced in 18b346def1 2015-02-09 21:08:21 -07:00
Spencer Gibb
18b346def1 update the serviceId and location for statically configured routes that are also part of serviceDiscovery.
fixes gh-199
2015-02-09 17:30:23 -07:00
Dave Syer
8dd9b830e0 Add logic for servlet prefix in ProxyRouteLocator
If the ServerProperties contain a servletPath then the handler mapping
does not contain that prefix, but the incoming request URI does. This leads
to some interesting prefix stripping gymnastics. All the existing tests
assumed that the prefix was empty (the default for a Spring boot app).

See gh-199
2015-02-09 15:04:54 +00:00
Spencer Gibb
94b0b7b692 add additional /hystrix.stream endpoint integration test 2015-02-05 14:18:44 -07:00
Spencer Gibb
27c418825d Revert "move /hystrix.stream from an endpoint to a servlet"
This reverts commit 29bee28db5.
2015-02-05 13:08:32 -07:00
Dave Syer
29383de8c1 Allow zuul.ignoredServices to be a pattern
and also allow explicitly configured services to be unignored. I.e.

zuul:
  ignoredServices: *
  routes:
    foo: /foo/**

Will expose only the foo service.

Fixes gh-198
2015-02-05 17:00:17 +00:00
Dave Syer
b8cf89fb45 Use an HttpMessageConverter for form body
Instead of building a String, if we use an existing
HttpMessageConverter from Spring web, we can support multipart
form data.

Fixes gh-197 (hopefully)
2015-02-05 16:32:33 +01:00
Julien Roy
00b689f58a Add retryable property on Zuul route configuration
The ProxyRouteLocator now has a retryable property (default
null which means Ribbon will choose the default - usually false).

Fixes gh-115, fixes gh-124
2015-02-04 15:02:49 +01:00
Dave Syer
4c5179130e Add metadataMap option for Server.zone
Adds a metadataMap for the Server.zone so that user can
provide the data through external configuration if needed.
2015-02-03 12:13:21 +01:00
Dave Syer
4afc44acaf Catch exception and log instead of failing
Some singleton clashes are inevitable if running multiple
apps i nteh same JVM, but we can at least try and not fall off
a cliff when they happen.
2015-02-03 10:38:57 +01:00
Dave Syer
63e6c813a3 Remove guava usages (fixes gh-154) 2015-01-30 14:10:38 +00:00
Spencer Gibb
29bee28db5 move /hystrix.stream from an endpoint to a servlet
fixes gh-187
2015-01-29 13:28:33 -07:00
Spencer Gibb
42422bef5c prepend http:// to feign url if not there 2015-01-29 11:53:14 -07:00
Dave Syer
6dc0bd5f5e Refactor @FeignClient to use name= or url= but not both
Replaces the boolean flag (loadbalance) for switching between service
resolution (by name) or straight URL bashing.
2015-01-29 17:40:56 +00:00
Dave Syer
9aa979cd31 @FeignClientScan -> @EnableFeignClients
By analogy with @EnableJpaRepositories, so it's obvious that
the same thing will happen (interfaces are turned into concrete
@Beans).
2015-01-29 17:39:59 +00:00
Dave Syer
fe08762f50 Rename package that was missing 'cloud' 2015-01-29 17:39:59 +00:00
Dave Syer
e100207e8a Clarify and document some Feign stuff 2015-01-29 17:39:59 +00:00
Spencer Gibb
af0b24d1a2 use LoadBalancerBuilder so all parts of the LoadBalancer can be injected via Spring.
This includes support for: ServerList, ServerListFilter, IRule, IPing and IClientConfig.
 Eliminates custom wrapping of ServerList.

 fixes gh-185
2015-01-28 12:33:32 -07:00
Spencer Gibb
01c5b44a18 propagate EnvironmentChangeEvents to archaius dynamic property listenters
fixes gh-144
2015-01-26 22:16:09 -07:00
Spencer Gibb
d78982973e add support for feign RequestInterceptors
fixes gh-159
2015-01-26 21:45:18 -07:00
Spencer Gibb
6435b73f40 remove EurekaHeartbeatEvent 2015-01-26 21:16:14 -07:00
Spencer Gibb
81bc83312c removed TODOs that are out of date 2015-01-26 20:48:39 -07:00
Spencer Gibb
32a9033661 upgrade to netflix eureka to 1.1.147
fixes gh-180
2015-01-26 15:30:06 -07:00
Spencer Gibb
e265a5e3c8 upgrade to netflix feign 7.1.0.
Add feign-slf4j support.

fixes gh-178
2015-01-26 14:54:01 -07:00
Dave Syer
b2301434d2 Align with API changes from config client 2015-01-25 11:49:13 +00:00
Spencer Gibb
cdf34fddb1 Auto configure EurekaClientAutoConfiguration after NoopDiscoveryClientAutoConfiguration 2015-01-23 10:55:37 -07:00
Dave Syer
d04800597c De-tangle zuul packages
The main problem here was the ZuulProperties being used everywhere. I also
took the opportunity to thin out the top level zuul package and keep the
web and route locator pieces in sub-packages for readability.

Fixes gh-172
2015-01-23 09:10:37 +00:00
Dave Syer
6b01e61dec Untangle ribbon/eureka
A cleaner separation of ribbon and the eureka-dependent ribbon
configuration is achieved by adding a BeanPostProcessor to do the
ServerList wrapping, instead of doing it for every single ribbon
client.

See gh-172
2015-01-23 08:57:58 +00:00
Spencer Gibb
ea4ea4a54d proxy DiscoveryHeartbeatEvent's from parent to child be publishing a EurekaHeartbeatEvent and having zuul listen for EurekaHeartbeatEvent as well.
fixes gh-171
2015-01-22 16:08:05 -07:00
Dave Syer
f18aeab873 Replace some of the log/printStackTraces with ignores
Fixes gh-153
2015-01-22 07:08:55 +00:00
Spencer Gibb
a45c0ccec8 change printStackTrace to commons log statements
fixes gh-153
2015-01-21 19:26:54 -07:00
Dave Syer
c31f700bae Use serviceId as prefix for RibbonCommand hystrix command key
Fixes gh-160
2015-01-19 16:13:13 +00:00
Spencer Gibb
a0b73fe7c7 migrate from slf4j to commons logging
fixes gh-147
2015-01-15 14:31:20 -07:00