superplate-core-plugins icon indicating copy to clipboard operation
superplate-core-plugins copied to clipboard

Reverse proxy is not workding

Open GargantuaX opened this issue 3 years ago • 0 comments

Reverse proxy is not workding. The Next JS rewrites plugin can working well.

My next.config.js:

const withPlugins = require("next-compose-plugins");
const rewrites = async () => {
    return process.env.NODE_ENV === "development" ? [
        // {
        //     source: "/x-api/:path*",
        //     destination: "http://127.0.0.1/x-api/:path*",
        // },
    ] : []
}

const config = {
    // rewrites,
    devServer: {
        proxy: {
            "/x-api": "http://127.0.0.1/x-api",
        },
    },
};

const semi = require('@douyinfe/semi-next').default({});

module.exports = withPlugins([
    [],
], semi({...config}));

My package.json:

{
  "name": "website",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "svgr": "npx @svgr/cli -d src/icons --ignore-existing --icon --typescript public/icons",
    "build:analyze": "ANALYZE=true npm run build"
  },
  "dependencies": {
    "@douyinfe/semi-ui": "^2.3.0",
    "@next/bundle-analyzer": "^10.0.5",
    "ahooks": "^3.1.7",
    "axios": "^0.21.1",
    "next": "12.0.7",
    "next-compose-plugins": "^2.2.1",
    "next-i18next": "^7.0.1",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-router-dom": "^6.2.1",
    "sass": "^1.32.5",
    "umi-request": "^1.4.0",
    "zustand": "^3.5.7"
  },
  "devDependencies": {
    "@douyinfe/semi-next": "^2.3.0",
    "@svgr/cli": "^5.5.0",
    "@types/node": "^14.14.13",
    "@types/react": "^17.0.0",
    "@types/react-dom": "^17.0.0",
    "typescript": "^4.1.3"
  }
}

GargantuaX avatar Jan 21 '22 06:01 GargantuaX