0
点赞
收藏
分享

微信扫一扫

VUE项目打包后posy代理失效Nginx解决

我是芄兰 2022-03-30 阅读 43
vuenginx

vue项目打包dist部署Nginx

Vueproxy代理失效Nginx解决办法

vue.config.js

 devServer: {
  proxy: {
            "/oauth2": {
                target: 'http://localhost:12911/oauth2/',
                secure: false,
                changeOrigin: true,
                pathRewrite: {
                    '^/oauth2': 'http://localhost:12911/oauth2/'
                },
            },
        },
     }

Nginx.conf

location /oauth2/ {
            proxy_pass http://localhost:12911/oauth2/;
			proxy_redirect off;
			proxy_set_header Host $host;
			proxy_set_header X-Real-IP $remote_addr;
		    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_connect_timeout 90;
			proxy_max_temp_file_size 0;
            index  index.html index.htm;
			access_log  logs/oauth2-auth.access.log;
			error_log  logs/oauth2-auth.error.log debug;
			
        }
举报

相关推荐

0 条评论