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

代理不生效呀 域名与端口还是原来的,不走target 设置 #444

Closed
GreenAppleOne opened this issue Jul 27, 2017 · 5 comments
Closed

Comments

@GreenAppleOne
Copy link

Error occured while trying to proxy to: localhost:8000/admin-fast/api/v1/user
@zuiidea

@utah2016
Copy link

utah2016 commented Aug 1, 2017

好像是win环境下不兼容 我也遇到这样问题,同求解决方法

@zuiidea
Copy link
Owner

zuiidea commented Aug 1, 2017

#348

@zuiidea
Copy link
Owner

zuiidea commented Aug 1, 2017

服务启动在8000,又把接口代理到8000???

@zuiidea zuiidea closed this as completed Aug 10, 2017
@XIRALIP
Copy link

XIRALIP commented Aug 11, 2017

tomcat启动也是代理不了
roadhogrc.js添加配置如下:
"proxy": {
"/api/v1": {
"target": "localhost:8080/xxx",
"changeOrigin": true,
"pathRewrite": { "^/api/v1" : "/v1" }
}
},
tomcat8000接口应该是给远程debug用的。。。
npm run dev以后
Something is already running on port 8000。Would you like to run the app on another port instead? (Y/n)提示这个选择yes
app在8001端口跑了
但是登录不了
请求的接口信息如下:
Request URL:http://localhost:8001/api/v1/user/login
Request Method:POST
Status Code:504 Gateway Timeout
Remote Address:127.0.0.1:8001
Referrer Policy:no-referrer-when-downgrade
Response Headers
view source
Connection:keep-alive
Date:Fri, 11 Aug 2017 09:14:48 GMT
Transfer-Encoding:chunked
X-Powered-By:Express
Request Headers
view source
Accept:application/json, text/plain, /
Accept-Encoding:gzip, deflate, br
Accept-Language:zh-CN,zh;q=0.8
Connection:keep-alive
Content-Length:39
Content-Type:application/json;charset=UTF-8
Cookie:Hm_lvt_82116c626a8d504a5c0675073362ef6f=1490013019; Hm_lvt_073f3069c89851ba45cb4eb471507a0a=1490602211
Host:localhost:8001
Origin:http://localhost:8001
Referer:http://localhost:8001/login?from=/test
User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Request Payload
view source
{username: "guest", password: "guest"}
password
:
"guest"
username
:
"guest"

谁能指导一下怎么解决?

@MrSuntb
Copy link

MrSuntb commented Jan 15, 2018

我也遇到同样的问题,无论在proxy那里,怎么设置,都不生效。还是走默认的8000端口

// 接口代理示例
proxy: {
"/api/v1/weather": {
"target": "https://api.seniverse.com/",
"changeOrigin": true,
"pathRewrite": { "^/api/v1/weather": "/v3/weather" }
},
"/api/v2": {
"target": "http://localhost:8080/",
"changeOrigin": true,
"pathRewrite": { "^/api/v2" : "" }
}
},

谁能指教一下

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

5 participants