Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse proxy is not workding #245

Open
GargantuaX opened this issue Jan 21, 2022 · 0 comments
Open

Reverse proxy is not workding #245

GargantuaX opened this issue Jan 21, 2022 · 0 comments

Comments

@GargantuaX
Copy link

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"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant