dosubot[bot] commented on issue #7525:
URL:
https://github.com/apache/incubator-devlake/issues/7525#issuecomment-2134234581
<!-- Answer -->
To resolve the "AxiosError: Request failed with status code 502" when trying
to access DevLake on your Windows local machine, follow these steps:
1. **Ensure the Server is Running**: Verify that the DevLake server is
started and running on the specified port. Use the `docker-compose.yml` file
provided in the DevLake repository to set up the necessary services.
2. **Check Docker Services**: Ensure all services defined in the
`docker-compose.yml` file are up and running. This includes `mysql`, `grafana`,
`devlake`, and `config-ui`.
3. **Verify Configuration**: Ensure that the environment variables and ports
are correctly configured in the `docker-compose.yml` file. For example, the
`devlake` service should be accessible on `127.0.0.1:8080`.
4. **Check Nginx Configuration**: Verify that the Nginx configuration for
the `config-ui` service is correctly set up. The `nginx.conf` file should
properly route requests to the DevLake and Grafana endpoints. Here is a
relevant part of the `nginx.conf` file:
```conf
server {
listen 80;
server_name localhost;
absolute_redirect off;
client_max_body_size 20m;
root /usr/share/nginx/html;
location = / {
add_header Cache-Control no-cache;
expires 0;
try_files /index.html =404;
}
location / {
try_files $uri /index.html;
}
location /api/ {
resolver 127.0.0.11 valid=30s;
resolver_timeout 3s;
set $target "devlake:8080";
rewrite ^ $request_uri;
rewrite ^/api/(.*) $1 break;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
proxy_pass http://$target/$uri;
proxy_http_version 1.1;
proxy_set_header "Connection" "";
}
location /api/rest/ {
auth_basic off;
resolver 127.0.0.11 valid=30s;
resolver_timeout 3s;
set $target "devlake:8080";
rewrite /api/(.*) /$1 break;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
proxy_pass http://$target;
proxy_http_version 1.1;
proxy_set_header "Connection" "";
}
location /grafana/ {
auth_basic off;
set $external "false";
if ($external = "true") {
return 302 "http://localhost:3002";
}
resolver 127.0.0.11 valid=30s;
resolver_timeout 3s;
set $target "grafana:3000";
proxy_set_header Host $http_host;
proxy_set_header Authorization "";
proxy_set_header X-Forwarded-Access-Token "${cookie_access_token}";
proxy_send_timeout 60s;
proxy_read_timeout 60s;
proxy_pass http://$target;
proxy_http_version 1.1;
proxy_set_header "Connection" "";
}
location /health/ {
auth_basic off;
return 200;
}
location /health {
auth_basic off;
return 200;
}
}
```
Ensure the server is properly configured and running on the specified port.
Use the `docker-compose up` command to start all the services and verify that
they are running without errors
<sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/test/helper/client.go)</sup><sup>[[2]](https://github.com/apache/incubator-devlake/blob/main/devops/releases/lake-v0.14.0/docker-compose.yml)</sup><sup>[[3]](https://github.com/apache/incubator-devlake/blob/main/config-ui/nginx.conf)</sup>.
<!-- Dosu Comment Footer -->
<details>
<summary>
#### Details
</summary>
**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.
</details>
*To continue the conversation, mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]