With Spring Boot 2.6.2 and Spring Cloud 2021.0.0 the config on the default git branch 'master' could be retrieved from the config server with the URL
/<spring.application.name>/<profile-name>
With Spring Boot 2.6.4 and Spring Cloud 2021.0.1 the result of the same request to the config server is 404 Not Found.
When the branch name 'master' is appended like this
/<spring.application.name>/<profile-name>/master
the request works
I suspected a relation to the new git default branch name main instead of master and added
spring:
cloud:
config:
server:
git:
default-label: master
to the config but it still does not work without appending master
Comment From: ryanjbaxter
Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.
Comment From: tspoeri
I was able to narrow it further down, it does not happen in general but only with spring profiles that contain a dash ('-'). It looks like the issue was introduced with "Adjust EnvironmentController for Path Pattern Parser #2031" which was introduced with Spring Cloud 2021.0.1. Downgrading to 2021.0.0 fixes the issue (i.e. downgrading Cloud Config Server from 3.1.1 to 3.1.0)
Reproduction:
- Unzip config-repo.zip
to the user home
- Unzip cloud-config-server.zip
to any directory, cd into that directory, execute ./gradlew bootRun
- With Cloud Config Server 3.1.0 all of the following URLs work:
http://localhost:8080/demo/prod
http://localhost:8080/demo/prod/master
http://localhost:8080/demo/pre-prod
http://localhost:8080/demo/pre-prod/master
With Cloud Config Server 3.1.1 the following URL (3rd one above) fails with a 404
http://localhost:8080/demo/pre-prod
We use profile names containing dashes ('-') for years, please restore the previous behavior.
cloud-config-server.zip config-repo.zip
Comment From: Stexxen
@tspoeri Good find! We've been struggling with this one as well. Downgraded back to 3.1.0, but hadn't identified what was causing it. Just checked the profiles and yes we use dashes in them.....
Also looks like it might have been fixed, https://github.com/spring-cloud/spring-cloud-config/issues/2058 tagged for 3.1.2
Comment From: ryanjbaxter
Yes I fixed this problem here https://github.com/spring-cloud/spring-cloud-config/commit/5fe66908775d50c51feab96fd26278415dee10a3
You can try our snapshot releases to confirm it was addressed.
Comment From: ryanjbaxter
Duplicate of https://github.com/spring-cloud/spring-cloud-config/issues/2058