apolloconfig / apollo

Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
https://www.apolloconfig.com
Apache License 2.0
28.93k stars 10.19k forks source link

在 apollo-portal统一增加访问路径的前缀/apollo 时,导入配置的请求url 有部分没有添加前缀 #5137

Closed xworks closed 2 weeks ago

xworks commented 1 month ago

描述bug

在 apollo-portal统一增加访问路径的前缀/apollo 时,导入配置的请求url 有部分没有添加前缀,导致无法导入配置

复现

通过如下步骤可以复现:

  1. 在导入配置页面,选择要导入的环境和要导入的配置 zip 包,点击导入,就会出现报错

期望

导入成功

截图 点击报错:

image

额外的细节和日志

dosubot[bot] commented 1 month ago

To address the issue where some request URLs are missing the /apollo prefix after adding it to the access path in Apollo Portal, causing configuration imports to fail, follow these steps:

  1. For Apollo Portal version 1.7.0 and above:

    • Ensure you've added the -D parameter server.servlet.context-path=/apollo or the system environment variable SERVER_SERVLET_CONTEXT_PATH=/apollo for apollo-portal.
    • Update your nginx/slb configuration to forward requests correctly. Here's an nginx configuration example:
      location /apollo/ {
       proxy_set_header X-Forwarded-Host $host;
       proxy_set_header X-Forwarded-Server $host;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_pass http://127.0.0.1:8070/apollo/;
      }
  2. For Apollo Portal version 1.6.0 and above:

    • Add the prefix.path=/apollo configuration parameter to the portal through the Administrator Tools - System Parameters page.
    • Use the following nginx configuration for forwarding:
      location /apollo/ {
       proxy_set_header X-Forwarded-Host $host;
       proxy_set_header X-Forwarded-Server $host;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_pass http://127.0.0.1:8070/;
      }

These steps ensure that the /apollo prefix is correctly handled, allowing for successful configuration imports. If the issue persists, please provide the exact error message and any relevant logs for further assistance. Ensure you have correctly added the /apollo prefix as per the recommended approach using server.servlet.context-path.

#### Details **Sources** - [docs/en/faq/common-issues-in-deployment-and-development-phase.md](https://github.com/apolloconfig/apollo/blob/master/docs/en/faq/common-issues-in-deployment-and-development-phase.md) - [apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigsImportService.java](https://github.com/apolloconfig/apollo/blob/master/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigsImportService.java) - [apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PrefixPathController.java](https://github.com/apolloconfig/apollo/blob/master/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PrefixPathController.java) - [apollo-portal/src/main/scripts/startup.sh](https://github.com/apolloconfig/apollo/blob/master/apollo-portal/src/main/scripts/startup.sh) - [apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ConfigsImportController.java](https://github.com/apolloconfig/apollo/blob/master/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ConfigsImportController.java) - [apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/GlobalDefaultExceptionHandler.java](https://github.com/apolloconfig/apollo/blob/master/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/GlobalDefaultExceptionHandler.java) - [changes/changes-2.2.0.md](https://github.com/apolloconfig/apollo/blob/master/changes/changes-2.2.0.md)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

stale[bot] commented 3 weeks ago

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[bot] commented 2 weeks ago

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.