go-webtools / knife4go

simply Assembled knife4j + gin-swagger, it means an enhanced version of gin-swagger with nice UI. Also, it can be called knife4go
MIT License
4 stars 1 forks source link

bug:在多级路由下前端页面报错 #2

Open taadis opened 1 year ago

taadis commented 1 year ago

通过nginx/k8s ingress反代多级路由时,路由定义如下:

r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))

r.GET("/knife4go/*any", knife4goGin.WrapHandler(knife4goFiles.Handler))

前端页面访问时

查看: swagger/index.html访问的是https://ipv4:port/path1/path2/swagger/doc.json 全路径正常 knife4go/index.html页面会直接访问根路由下的https://ipv4:port/openapi.json导致失败

alwaysbetter1314 commented 1 year ago

最新版已经修复,去除了gin中对/openapi.json路由配置。

alwaysbetter1314 commented 1 year ago

nginx代理时, 如果host不对, 可以自定义配置请求HOST (ip:port/ginapp) image