spring-cloud / spring-cloud-config

External configuration (server and client) for Spring Cloud
Apache License 2.0
1.95k stars 1.29k forks source link

Serving plain text file using a default label is not working in Finchley M9 #961

Open ojhughes opened 6 years ago

ojhughes commented 6 years ago

Using a config server at version Finchley.M9 with the following properties

spring:
  application:
    name: testapp
  profiles:
    active: native
  cloud:
    config:
      server:
        default-label: default-label-test

and config directory layout src/main/resources/config/default-label-test/default-label-nginx.conf

When I request the contents of default-label-nginx.conf with a request curl http://localhost:9999/testapp/native/default-label-nginx.conf\?useDefaultLabel, the mapped controller is https://github.com/spring-cloud/spring-cloud-config/blob/master/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/EnvironmentController.java#L99 but should be https://github.com/spring-cloud/spring-cloud-config/blob/master/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/ResourceController.java#L81

Using Edgware.SR2 the correct controller method is mapped

@snicoll mentioned that request mapping has changed in Boot 2, see https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide#spring-mvc-path-matching-default-behavior-change

ojhughes commented 6 years ago

Following Stephane's advice, setting the property mvc.pathmatch.use-suffix-pattern=true and mvc.pathmatch.use-registered-suffix-pattern=false appears to resolve this issue. I am going to run a full set of Acceptance Tests with this property enabled and make sure there are no regressions. If all is well I will open a PR to update documentation regarding the above properties

marcingrzejszczak commented 6 years ago

hey @ojhughes - can we close it?

spencergibb commented 5 years ago

Let's document this as a note.