Spring-cloud-config: Serving plain text file using a default label is not working in Finchley M9

Created on 4 Apr 2018  路  3Comments  路  Source: spring-cloud/spring-cloud-config

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

documentation

Most helpful comment

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

All 3 comments

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

hey @ojhughes - can we close it?

Let's document this as a note.

Was this page helpful?
0 / 5 - 0 ratings