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

server.conf proxy不支持post请求吗? #927

Closed
henryzp opened this issue Aug 22, 2016 · 7 comments
Closed

server.conf proxy不支持post请求吗? #927

henryzp opened this issue Aug 22, 2016 · 7 comments

Comments

@henryzp
Copy link

henryzp commented Aug 22, 2016

get请求是OK的。

post请求,我写了一个node服务器,在写了data对象之后,

image

另外有同事反馈说post传递过去的data,java接收不了。

@hefangshi
Copy link
Member

属于Node.js问题,不属于FIS问题。

@henryzp
Copy link
Author

henryzp commented Sep 5, 2016

@hefangshi ,。。。。

nodejs能处理post请求啊,更何况你们还内置了express

@younth
Copy link

younth commented Nov 13, 2016

proxy post确实有点问题啊,get正常。

@2betop
Copy link
Contributor

2betop commented Nov 14, 2016

注意,目标文件发布后必须是 /test 或者 /mock 目录,否则,默认的 express-static 是不支持 post 请求到静态文件的。

@younth
Copy link

younth commented Nov 14, 2016

@2betop 我们说的是proxy不支持Post 正常的rewrite是支持的。

@animabear
Copy link

animabear commented Jul 25, 2017

中间件顺序的问题,fis3-server-node 需要作以下调整:

app.js

app.use(require('yog-devtools')({
    view_path: '',    // 避免报错。
    rewrite_file: [path.join(DOCUMENT_ROOT, 'config', 'server.conf'), path.join(DOCUMENT_ROOT, 'mock', 'server.conf')],
    data_path: [path.join(DOCUMENT_ROOT, 'test'), path.join(DOCUMENT_ROOT, 'mock')]
}));

// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))

// parse application/json
app.use(bodyParser.json())

即把 bodyParser 放在 yog-devtools 后面。具体原因可以参考:http-party/node-http-proxy#180

@2betop
Copy link
Contributor

2betop commented Jul 25, 2017

  • fis3@3.4.34 已修复

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