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

2023.0.1.3 spring gateway can not route to service when using spring config imports. #3914

Open
liqiang7070 opened this issue Dec 2, 2024 · 3 comments
Labels

Comments

@liqiang7070
Copy link

gateway:
  routes:
    - id: docker-example
      uri: lb://docker-example
      predicates:
        - Path=/docker-example/**
      filters:
        - StripPrefix=1
      metadata:
        response-timeout: 30000

https://127.0.0.1:8100/docker-example/hello
I get this response.
[34c40c6c-25] There was an unexpected error (type=Not Found, status=404).

@yuluo-yx
Copy link
Collaborator

yuluo-yx commented Dec 4, 2024

看不出来啥问题

@yuluo-yx yuluo-yx added the waiting-for-feedback Waiting for user feedback label Dec 4, 2024
@liqiang7070
Copy link
Author

liqiang7070 commented Dec 10, 2024

使用如下依赖:
<spring.boot.version>3.3.5</spring.boot.version>
<spring.cloud.version>2023.0.3</spring.cloud.version>
<spring.cloud.alibaba.version>2023.0.1.3</spring.cloud.alibaba.version>

进行如下测试:
1)bootstrap.yml中的配置如下时, 不能正常显示测试页面:
server:
port: 8100

spring:
application:
name: gateway-example

cloud:
nacos:
server-addr: https://svr.example.org:8848
username: nacos
password: nacos
discovery:
namespace: myspace
config:
namespace: myspace

config:
import:
- nacos:common-management.yml

gateway:
  routes:
    - id: nginx
      uri: http://192.168.56.54
      predicates:
        - Path=/nginx/**
      filters:
        - StripPrefix=1

image

2) bootstrap.yml中的配置如下时(注释掉了config.import),可以正常显示测试页面:
server:
port: 8100

spring:
application:
name: gateway-example

cloud:
nacos:
server-addr: https://svr.example.org:8848
username: nacos
password: nacos
discovery:
namespace: myspace
config:
namespace: myspace

# config:
# import:
# - nacos:common-management.yml

gateway:
  routes:
    - id: nginx
      uri: http://192.168.56.54
      predicates:
        - Path=/nginx/**
      filters:
        - StripPrefix=1

可以正常显示页面:
image

Copy link

github-actions bot commented Jan 9, 2025

This issue has been open 30 days with no activity. This will be closed in 7 days.

@github-actions github-actions bot added the stale label Jan 9, 2025
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