apolloconfig / apollo

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

apollo-portal 使用统一前缀/apollo以后,创建集群失败 #5139

Closed xworks closed 3 months ago

xworks commented 6 months ago

描述bug portal站点统一使用路径前缀/apollo,创建集群失败

复现

通过如下步骤可以复现:

  1. portal站点统一使用路径前缀/apollo,创建集群

期望

创建成功

截图 截图显示路径不对,404

image

额外的细节和日志

dosubot[bot] commented 6 months ago

It looks like the issue with creating clusters when using the /apollo path prefix might be due to incorrect reverse proxy configuration or the Apollo Portal application not being properly set up to handle the /apollo context path. Here's a more focused approach to troubleshoot and resolve this issue:

  1. Ensure Apollo Portal is Configured for /apollo Context Path: Make sure the Apollo Portal application is configured to recognize the /apollo context path. This can be done by setting the system property -Dserver.servlet.context-path=/apollo or the equivalent environment variable SERVER_SERVLET_CONTEXT_PATH=/apollo.

  2. Configure Reverse Proxy Correctly: If you're using a reverse proxy like nginx, ensure it's configured to forward requests to the Apollo Portal application correctly. An example nginx configuration would be:

    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/;
    }

    This configuration ensures that requests to /apollo are forwarded correctly, including the path prefix.

  3. Check for Existing Clusters with the Same Name: The error might also occur if a cluster with the specified name already exists. The Apollo system throws a BadRequestException for duplicate cluster names during creation.

  4. Verify Request Payload and Permissions: Ensure that the request payload for creating a cluster is correctly formatted and includes all required fields. Also, verify that the user account used for the operation has the necessary permissions.

  5. Review Logs and Error Messages: Look into the Apollo Portal's log files for any error messages or stack traces related to the cluster creation process. This can provide more specific insights into what might be going wrong.

By following these steps, you should be able to identify and resolve the issue with creating clusters when using the /apollo path prefix. If the problem persists, providing more detailed information such as error logs, request payloads, and the specific configurations you're using can help further diagnose the issue.

#### Details **Sources** - [在portal访问项目,返回404](https://github.com/apolloconfig/apollo/discussions/3622) - [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/resources/static/scripts/controller/ClusterController.js](https://github.com/apolloconfig/apollo/blob/master/apollo-portal/src/main/resources/static/scripts/controller/ClusterController.js) - [apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ClusterController.java](https://github.com/apolloconfig/apollo/blob/master/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ClusterController.java) - [apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ClusterController.java](https://github.com/apolloconfig/apollo/blob/master/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ClusterController.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-common/src/main/java/com/ctrip/framework/apollo/common/dto/ClusterDTO.java](https://github.com/apolloconfig/apollo/blob/master/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ClusterDTO.java)
**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 5 months 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 4 months 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 3 months 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.