Serving plain-text files from Spring Cloud Config Server with S3 Backend

Solution for Serving plain-text files from Spring Cloud Config Server with S3 Backend
is Given Below:

We are trying to migrate our Spring Cloud Config Server from a Git Backend to S3. This is working fine for the normal configuration yaml files, but we also use it to serve plain text files and are having problems getting that working.

According to this issue https://github.com/spring-cloud/spring-cloud-config/issues/1506 and the documentation here https://cloud.spring.io/spring-cloud-static/spring-cloud-config/2.2.3.RELEASE/reference/html/#spring-cloud-config-serving-plain-text-aws-s3 this should work, but the documentation describes the URL format for the Git Backend but not the S3 Backend.

Previously we used:

https://config-host/a/b/master/myfile.txt

And this worked. What format should we use for S3?

Ive tried

https://config-host/test/b/c/myfile.txt

and noticed this in the logs:

2021-07-30 17:46:35.787  WARN 1 --- [  XNIO-1 task-3] o.s.c.config.server.support.PathUtils    : Resource path "https://s3.us-west-2.amazonaws.com/my-bucket/test" was successfully resolved but resource "https://s3.us-west-2.amazonaws.com/my-bucket/test%2Fmyfile.txt" is neither under the current location "https://s3.us-west-2.amazonaws.com/my-bucket/test" nor under any of the allowed locations [Amazon s3 resource [bucket="my-bucket" and object="test"]]

(after putting myfile.txt in the test folder in my-bucket)

Maybe there is an issue with the encoding here – ie test%2Fmyfile.txt?

We are using spring-cloud 2020.0.3 and spring-cloud-aws 2.3.0