Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config service(version 2.0.0-RC1 or above) return 404 when use double slash "//" in http path #4947

Closed
3 tasks done
Anilople opened this issue Aug 1, 2023 · 4 comments
Closed
3 tasks done
Labels

Comments

@Anilople
Copy link
Contributor

Anilople commented Aug 1, 2023

  • I have checked the discussions
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Describe the bug

apollo client read config fail when there is a slash in the suffix of apollo.meta, for example

apollo.meta=http://ip:port/

but it work well when / doesn't occur in the suffix. i.e

apollo.meta=http://ip:port

Reproduce

run

curl http://localhost:8080//services/config

to access config service, version 2.0.0-RC1

get

{"timestamp":"2023-08-01T21:49:31.123+0800","status":404,"error":"Not Found","path":"//services/config"}

watch out that // after port 8080

image

Expected behavior

get json like

[{"appName":"APOLLO-CONFIGSERVICE","instanceId":"localhost:apollo-configservice:8080","homepageUrl":"http://172.29.234.239:8080/"}]

image

Additional Details & Logs

  • Platform and Operating System
$ java -version
openjdk version "1.8.0_362"
OpenJDK Runtime Environment (build 1.8.0_362-8u372-ga~us1-0ubuntu1~20.04-b09)
OpenJDK 64-Bit Server VM (build 25.362-b09, mixed mode)
  • Version 2.0.0-RC1 or above
config service's version double slash "//" work or not
1.8.2 work well
1.9.2 work well
2.0.0-RC1 404
2.0.1 404

more detail from version 1.8.2 to 2.0.1

1.8.2

curl http://localhost:8080/services/config

[{"appName":"APOLLO-CONFIGSERVICE","instanceId":"localhost:apollo-configservice:8080","homepageUrl":"http://172.29.234.239:8080/"}]

curl http://localhost:8080//services/config

[{"appName":"APOLLO-CONFIGSERVICE","instanceId":"localhost:apollo-configservice:8080","homepageUrl":"http://172.29.234.239:8080/"}]

1.9.2

curl http://localhost:8080/services/config

[{"appName":"APOLLO-CONFIGSERVICE","instanceId":"localhost:apollo-configservice:8080","homepageUrl":"http://172.29.234.239:8080/"}]

curl http://localhost:8080//services/config

[{"appName":"APOLLO-CONFIGSERVICE","instanceId":"localhost:apollo-configservice:8080","homepageUrl":"http://172.29.234.239:8080/"}]

2.0.0-RC1

curl http://localhost:8080/services/config

[{"appName":"APOLLO-CONFIGSERVICE","instanceId":"localhost:apollo-configservice:8080","homepageUrl":"http://172.29.234.239:8080/"}]

curl http://localhost:8080//services/config

{"timestamp":"2023-08-01T21:54:25.152+0800","status":404,"error":"Not Found","path":"//services/config"}

2.0.1

curl http://localhost:8080/services/config

[{"appName":"APOLLO-CONFIGSERVICE","instanceId":"localhost:apollo-configservice:8080","homepageUrl":"http://172.29.234.239:8080/"}]

curl http://localhost:8080//services/config

{"timestamp":"2023-08-01T21:49:31.123+0800","status":404,"error":"Not Found","path":"//services/config"}

trouble shoot

apollo-client

https://github.com/apolloconfig/apollo-java/blob/265fe49ddf0a4becad40ecf5bcd6bd1c86d9826b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/ConfigServiceLocator.java#L248C26-L248C35

    return domainName + "/services/config?" + MAP_JOINER.join(queryParams);

when domainName(apollo.meta) is http://ip:port/ will get double slash // in http://ip:port//services/config?...

config-service

The path mapping in

Guess that when Spring MVC or Spring WebFlux update in #4295 cause it?

I.e '//' cannot access again.


solution:

  • apollo-client: delete the suffix '/' of apollo.meta on then runtime?
  • config service: keep the compability? For example add a servlet filter when meet '//' then convert it to '/'
@nobodyiam
Copy link
Member

The release notes for Spring Boot 2.6 include a section titled PathPattern Based Path Matching Strategy for Spring MVC. This particular change seems to have escaped my attention when issue #4295 was raised. To maintain the original logic, should we set the following configuration as the default?

spring.mvc.pathmatch.matching-strategy=ant-path-matcher

@stale
Copy link

stale bot commented Sep 3, 2023

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 3, 2023
@stale
Copy link

stale bot commented Sep 11, 2023

This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.

@stale stale bot closed this as completed Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants