0xfurai / 0xfurai/peekaping

Swagger doc.json has hard coded host to localhost:8034

未關閉 適合新手
#238 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Go
星號
1.2k
分支
69
PR 合併指標
30 天內沒有已合併 PR

描述

**Describe the bug**
I am testing running the API through a reverse proxy domain using the microservice docker images, however the Swagger host seems to be hard coded, e.g. in `doc.json`:

```json
{
"schemes": [],
"swagger": "2.0",
"info": {
"description": "",
"title": "Peekaping API",
"contact": {},
"version": "0.0.44"
},
"host": "localhost:8034",
"basePath": "/api/v1",
"paths": {
...
```

This means I can't actually run requests through myapiurl.com/swagger/index.html because it tries to connect to `localhost:8034` instead of `myapiurl.com`.

**Database**
- postgresql

**To Reproduce**
Steps to reproduce the behavior:
1. Have the API proxying through a domain, eg. https://myapiurl.com.
2. Visit https://myapiurl.com/swagger/index.html
3. See the base URL does not match domain.
4. Visit https://myapiurl.com/swagger/doc.json
5. See the host property is hard coded: ` "host": "localhost:8034",`

**Expected behavior**
The Swagger Base URL should match the domain so requests can be sent using the Swagger UI to the domain instead of http://localhost:8034

**Screenshots**
Image

**Desktop (please complete the following information):**
- OS: Linux
- Browser: Brave
- Version: 1.84 / Chromium 142.0.7444.176

**Additional context**
None

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

該 issue 指向 Swagger 的 doc.json 檔案中硬編碼的主機。請尋找產生此 JSON 的程式碼,很可能在 Swagger 或 API 文件設定中。檢查應控制主機的設定檔或環境變數。目標是讓主機基於請求網域動態變化,而非固定為 localhost:8034。透過在反向代理後執行服務並驗證 Swagger UI 是否使用正確的網域來進行測試。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
go
領域
api, documentation
Issue 類型
缺陷
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
描述清楚
新手友好度
65/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。