spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

Enhancement - Default Port on URI

Open mncaribou opened this issue 8 years ago • 0 comments

Feature request to default the right port on URIs specified in the route spec, otherwise throw an exception to avoid partial configuration issues.

Using Cloud BUILD-SNAPSHOT as of 2/17/2018 ext { springCloudVersion = 'Finchley.BUILD-SNAPSHOT' }

When specifying the routes off of the RouteLocatorBuilder, you have to remember to specify the port.

@Bean
public RouteLocator customRouteLocator(RouteLocatorBuilder rlb) {
	return rlb
		.routes()
		.route(spec -> spec
			.path("/google")
			.uri("https://www.google.com") // no port
		)
		.build();
}

Results in

2018-02-18 10:48:04.877 ERROR 6956 --- [ctor-http-nio-4] .a.w.r.e.DefaultErrorWebExceptionHandler : Failed to handle request [GET http://localhost:8080/google]

io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection timed out: no further information: www.google.com/216.58.192.228:8080

Changing the route to be https://www.google.com:443

Gets it to work fine

mncaribou avatar Feb 18 '18 16:02 mncaribou