uni-app web 模式跨域问题

uni-app 跨域 反向代理 About 443 words

解决方法

打开manifest.json,在源码试图HBuilder中打开才有)或者以文本形式打开。

添加h5节点,指定devServerproxy。注意:重新运行工程。

{
    "h5": {
        "router": {
            "mode": "history"
        },
        "devServer": {
            "port": 5173,
            "proxy": {
                "/api": {
                    "target": "http://localhost:8080",
                    "changeOrigin": true,
                    "secure": false
                }
            }
        }
    }
}
Views: 21 · Posted: 2025-07-19

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh