【发布时间】:2017-10-31 13:23:30
【问题描述】:
我们正在开发一个带有 python 烧瓶后端的反应应用程序。通常它一切正常,但是当将它放在具有客户端证书要求的服务器后面时,它几乎可以工作。它在 Chrome 中运行良好,而不是在 Firefox 中。
在浏览器中输入url时发送证书,react请求时不发送证书。
- 主请求正常完成,页面显示出来。
- 加载页面时向后端/backend/version 发出请求。
- 该请求失败,nginx 说
<html>
<head><title>400 No required SSL certificate was sent</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>No required SSL certificate was sent</center>
<hr><center>nginx/1.10.3</center>
</body>
</html>
- 当我打开 devtools 并粘贴相同的 url 时,它工作正常。客户端证书由浏览器发送。
我们如何提出请求:
const fetchVersion = () => (dispatch, getState) => {
return dispatch({
[CALL_API]: {
endpoint: `${API_ROOT}/version`,
method: 'GET',
headers: {
"Authorization": authHeader(),
},
types: [FETCH_VERSION_REQUEST,
{
type: FETCH_VERSION_SUCCESS,
payload: (action, state, res) => {
const contentType = res.headers.get('Content-Type');
if (contentType && ~contentType.indexOf('json')) {
return res.json().then(json => json.response);
}
},
},
{
type: FETCH_VERSION_FAILURE,
meta: (action, state, res) => checkIfInvalidToken(action, state, res, dispatch),
}
],
},
});
};
缺少什么?为什么 Firefox 不像 Chrome 那样将证书附加到请求中?
【问题讨论】:
-
对我来说好像是这个stackoverflow.com/questions/24005354/… ?
标签: javascript reactjs firefox nginx client-certificates