diff --git a/spring-cloud.html b/spring-cloud.html index 887a410..bc2ea63 100644 --- a/spring-cloud.html +++ b/spring-cloud.html @@ -499,6 +499,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
  • Router and Filter: Zuul @@ -1945,34 +1946,32 @@ springBoot { -
    +
    @@ -2713,6 +2712,41 @@ server if you set a default route ("/"), for example zuul.route.home:
    +

    Uploading Files through Zuul

    +
    +

    If you @EnableZuulProxy you can use the proxy paths to +upload files and it should just work as long as the files +are small. For large files there is an alternative path +which bypasses the Spring DispatcherServlet (to +avoid multipart processing) in "/zuul/". I.e. if +zuul.routes.customers=/customers/* then you can +POST large files to "/zuul/customers/*". The servlet +path is externalized via zuul.servletPath. Extremely +large files will also require elevated timeout settings +if the proxy route takes you through a Ribbon load +balancer, e.g.

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

    Note that for streaming to work with large files, you need to use chunked encoding in the request (which some browsers +do not do by default). E.g. on the command line:

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

    Plain Embedded Zuul

    You can also run a Zuul server without the proxying, or switch on parts of the proxying platform selectively, if you @@ -3026,16 +3060,17 @@ configuration:

    application.yml
    -
    spring.oauth2:
    -  client:
    -    clientId: bd1c0a783ccdd1c9b9e4
    -    clientSecret: 1a9030fbca47a5b2c28e92f19050bb77824b5ad1
    -    tokenUri: https://github.com/login/oauth/access_token
    -    authorizationUri: https://github.com/login/oauth/authorize
    -    authenticationScheme: form
    -  resource:
    -    userInfoUri: https://api.github.com/user
    -    preferTokenInfo: false
    +
    spring:
    +  oauth2:
    +    client:
    +      clientId: bd1c0a783ccdd1c9b9e4
    +      clientSecret: 1a9030fbca47a5b2c28e92f19050bb77824b5ad1
    +      accessTokenUri: https://github.com/login/oauth/access_token
    +      userAuthorizationUri: https://github.com/login/oauth/authorize
    +      clientAuthenticationScheme: form
    +    resource:
    +      userInfoUri: https://api.github.com/user
    +      preferTokenInfo: false
    @@ -3095,10 +3130,11 @@ class Application {
    application.yml
    -
    oauth2:
    -  resource:
    -    userInfoUri: https://api.github.com/user
    -    preferTokenInfo: false
    +
    spring:
    +  oauth2:
    +    resource:
    +      userInfoUri: https://api.github.com/user
    +      preferTokenInfo: false
    @@ -3492,7 +3528,7 @@ ProxyAuthenticationProperties for full details.

    -
    Note
    +
    Tip
    -

    The Eureka server is tied to log4j and doesn’t work with logback, -so the dependency configuration -has to be tweaked compared to a normal Spring Boot app. The -spring-cloud-starter-eureka-server does this for you, but if you -add logback transitively through another dependency you will need to -exclude it manually, e.g. in Maven

    +

    Due to Gradle’s dependency resolution rules and the lack of a parent bom feature, simply depending on spring-cloud-starter-eureka-server can cause failures on application startup. To remedy this the Spring dependency management plugin must be added and the Spring cloud starter parent bom must be imported like so:

    -
    pom.xml
    +
    build.gradle
    -
    <dependency>
    -    <groupId>org.springframework.boot</groupId>
    -    <artifactId>spring-boot-starter-web</artifactId>
    -    <exclusions>
    -        <exclusion>
    -            <artifactId>spring-boot-starter-logging</artifactId>
    -            <groupId>org.springframework.boot</groupId>
    -        </exclusion>
    -    </exclusions>
    -</dependency>
    +
    buildscript {
    +  dependencies {
    +    classpath "io.spring.gradle:dependency-management-plugin:0.4.0.RELEASE"
    +  }
    +}
    +
    +apply plugin: "io.spring.dependency-management"
    +
    +dependencyManagement {
    +  imports {
    +    mavenBom 'org.springframework.cloud:spring-cloud-starter-parent:1.0.0.RELEASE'
    +  }
    +}