Shiro icon indicating copy to clipboard operation
Shiro copied to clipboard

本地跑前端项目显示接口报错,但已经配好了反向代理,求解

Open CathLee opened this issue 1 year ago • 3 comments

Describe the bug

⨯ FetchError: [GET] "https://cathylee.xyz/api/v2/aggregate?theme=shiro": fetch failed at async fetcher (api.tsx:24:31) digest: "1733242172" Cause: TypeError: fetch failed at Object.fetch (node:internal/deps/undici/undici:11576:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async $fetchRaw2 (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/ofetch/dist/shared/ofetch.37386b05.mjs:230:26) at async $fetch2 (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/ofetch/dist/shared/ofetch.37386b05.mjs:276:15) at async fetcher (webpack-internal:///(rsc)/./src/app/(app)/api.tsx:24:31) { cause: Error: read ECONNRESET at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) { errno: -4077, code: 'ECONNRESET', syscall: 'read' } }

Reproduction

dev

System Info

pnpm run dev

Used Package Manager

pnpm

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [X] The provided reproduction is a minimal reproducible of the bug.

CathLee avatar Aug 11 '24 09:08 CathLee

屏幕截图 2024-08-11 172844 这个是我的后端反向代理。而且还有一个神奇的现象,就是连上梯子之后,https://cathylee.xyz/api/v2都打不开,不知道是不是因为服务器是国内的腾讯云的问题(菜鸡托腮

CathLee avatar Aug 11 '24 09:08 CathLee

前端有配https没

jiuyue52 avatar Aug 11 '24 10:08 jiuyue52

不太清除前端配https,具体是指什么情况(小白勿怪 后端域名是有配好ssl和强制https的 屏幕截图 2024-08-11 190359

issue里的报错是我本地localhost:2323的页面,不太清楚和配置https是否有关系 屏幕截图 2024-08-11 190800 要是有大佬解答就好了(•_•)

前端有配https没

CathLee avatar Aug 11 '24 11:08 CathLee

https://cathylee.xyz/api/v2/aggregate?theme=shiro

要在本地运行的话,后端 docker-compose.yml ALLOWED_ORIGINS 里需要加上 localhost:*,127.0.0.1:*

suemor233 avatar Aug 12 '24 07:08 suemor233