Files
test-alert/README.md
2026-04-07 14:23:09 +08:00

106 lines
2.6 KiB
Markdown

# Risk-Guard
This project is a secondary development based on the Alibaba open-source template [Ant Design Pro](https://pro.ant.design), which uses React, UmiJS, Ant Design and other technology stacks.
## Install Dependencies
Install `node_modules`:
```bash
pnpm i
```
Or install dependencies using `yarn` or `npm`.
### Start the Project
```bash
pnpm start
```
### Build the Project
```bash
pnpm build
```
## More Information
You can view the complete documentation at the [official website](https://pro.ant.design).
Since the project routing uses history mode, nginx configuration is required, otherwise refreshing the page will result in 404 errors. Additionally, since SSE interfaces are used, some special configurations are also needed.
```nginx
server {
listen 80;
# server_name your-domain.com;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
root /data/react;
index index.html;
# Homepage negotiation cache
location = /index.html {
add_header Cache-Control "no-cache";
}
# Static resources
location ~* \.(?:js|css|woff2?|eot|ttf|svg|ico|png|jpg|jpeg|gif|webp)$ {
gzip on;
gzip_min_length 10k;
gzip_types application/javascript text/plain application/x-javascript text/css application/xml text/javascript;
gzip_comp_level 6;
expires 1d;
add_header Cache-Control "public, immutable";
}
# SPA routing
location / {
try_files $uri $uri/ /index.html;
}
# SSE interface
location = /api/sse/connect {
proxy_http_version 1.1;
proxy_set_header Connection '';
proxy_set_header Cache-Control "no-transform";
proxy_set_header X-Accel-Buffering "no";
proxy_buffering off;
proxy_read_timeout 86400s;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
# Path rewriting
rewrite ^/api(/.*)$ $1 break;
proxy_pass http://127.0.0.1:8090;
}
# API proxy
location /api/ {
# Path rewriting
rewrite ^/api(/.*)$ $1 break;
gzip on;
gzip_types application/json;
gzip_comp_level 6;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8090;
}
}
```