fix(config): 更新API基础URL配置和开发环境代理设置

- 修改前端开发环境API基础URL添加/api路径前缀
- 调整web环境配置中API基础URL为相对路径
- 在后端Markdown控制器中添加测试接口的非生产环境限制
- 更新Vite代理配置注释说明路径重写功能
This commit is contained in:
ikmkj
2026-01-26 07:13:02 +08:00
parent e54e076278
commit 0426ad22b7
4 changed files with 5 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
@@ -26,6 +27,7 @@ public class MarkdownController {
@Operation(summary = "测试")
@GetMapping("/test")
@Profile("!prod")
public R<List<MarkdownFile>> test() {
List<MarkdownFile> test = markdownFileService.test();
return R.success(test);

View File

@@ -1 +1 @@
VITE_API_BASE_URL=https://hdy16-16.311169.xyz
VITE_API_BASE_URL=https://hdy16-16.311169.xyz/api

View File

@@ -1,3 +1,3 @@
VITE_BASE_URL=/
VITE_API_BASE_URL=https://hdy16-16.311169.xyz
VITE_API_BASE_URL=/

View File

@@ -18,7 +18,7 @@ export default defineConfig(({ mode }) => {
'/api': {
target: 'http://127.0.0.1:8084',
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, '')
rewrite: path => path.replace(/^\/api/, '') //去掉 api
}
}
},