title: Spring cloud, Zuul https
body: <p>I have problem with https services in my Gateway application ( which uses zuul )
  it works great when proxying http services, but i have problems with proxying https services
  I have exception</p>
  
  <pre><code>java.lang.IllegalStateException: Could not create URI object: Expected scheme-specific part at index 6: https:
             at org.springframework.web.util.HierarchicalUriComponents.toUri(HierarchicalUriComponents.java:430) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
             at org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration$OverrideRestClient.reconstructURIWithServer(RibbonClientConfiguration.java:184) ~[spring-cloud-netflix-core-1
             at com.netflix.client.AbstractLoadBalancerAwareClient$1.call(AbstractLoadBalancerAwareClient.java:106) ~[ribbon-loadbalancer-2.1.5.jar:2.1.5]
             at com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:303) ~[ribbon-loadbalancer-2.1.5.jar:2.1.5]
             at com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:287) ~[ribbon-loadbalancer-2.1.5.jar:2.1.5]
             at rx.internal.util.ScalarSynchronousObservable$4.call(ScalarSynchronousObservable.java:223) ~[rxjava-1.1.5.jar:1.1.5]
             at rx.internal.util.ScalarSynchronousObservable$4.call(ScalarSynchronousObservable.java:220) ~[rxjava-1.1.5.jar:1.1.5]
             at rx.Observable.unsafeSubscribe(Observable.java:8460) ~[rxjava-1.1.5.jar:1.1.5]
             ... 150 common frames omitted
      aused by: java.net.URISyntaxException: Expected scheme-specific part at index 6: https:
             at java.net.URI$Parser.fail(URI.java:2848) ~[na:1.8.0_92]
             at java.net.URI$Parser.failExpecting(URI.java:2854) ~[na:1.8.0_92]
             at java.net.URI$Parser.parse(URI.java:3057) ~[na:1.8.0_92]
             at java.net.URI.&lt;init&gt;(URI.java:673) ~[na:1.8.0_92]
  </code></pre>
  
  <p>My Gateway config</p>
  
  <pre><code>server:
    ssl:
      key-store: classpath:my.jks
      key-store-password: secret
      key-password: secret 
  spring:
    application:
      name: mille-gateway
    cloud:
      config:
        discovery:
          enabled: true
          serviceId: mille-config-server
  eureka:
    client:
      healthcheck:
        enabled: true
  ribbon:
    IsSecure: true
  zuul:
    ignoredServices: '*'
    routes:
       test:
        path: /test/**
        serviceId: mille-test2
  
  test:
    ribbon:      
      ReadTimeout: 5000
      MaxAutoRetries: 2
      IsSecure: true
  My Registry ( Eureka ) server
  server:
  port: 8761
  </code></pre>
  
  <p>eureka:</p>
  
  <pre><code> instance:
      hostname: localhost
    client:
      registerWithEureka: false
      fetchRegistry: false
      serviceUrl:
        defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
    server:
      enableSelfPreservation: false
  </code></pre>
  
  <p>My client configuration</p>
  
  <pre><code>spring:
    application:
      name: mille-test2
    cloud:
      config:
        discovery:
          enabled: true
          serviceId: mille-config-server
  eureka:
    client:
      healthcheck:
        enabled: true  
  server:
    port: 50000
    ssl:
      key-store: classpath:my.jks
      key-store-password: secret
      key-password: secret 
  
  eureka:
    client:
      enabled: true
      serviceUrl:
        defaultZone: http://localhost:8761/eureka/
    instance:
      nonSecurePortEnabled: false
      securePortEnabled: true
      securePort: ${server.port}    
      instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
      statusPageUrl: https://${eureka.hostname}:${server.port}/info
      healthCheckUrl: https://${eureka.hostname}:${server.port}/health
      homePageUrl: https://${eureka.instance.hostname}:${server.port}/
      secureVirtualHostName: ${spring.application.name}
      metadataMap:
         hostname: ${eureka.instance.hostname}
         securePort: ${server.port}  
  </code></pre>
  
  <p><strong>What could be a problem ?</strong></p>