我在Heroku上有分期和制作应用程序.
对于crawler,我设置了robots.txt文件.
之后我收到了谷歌的消息.
尊敬的网站管理员:您网站的主机名https://www.myapp.com/与SSL证书中的任何"主题名称"都不匹配,即:
*.herokuapp.com
herokuapp.com
谷歌机器人读取我的临时应用程序上的robots.txt并发送此消息.因为我没有设置任何防止抓取工具读取文件的内容.
所以,我正在考虑的是在暂存和生产之间更改.gitignore文件,但我无法弄清楚如何做到这一点.
实现这个的最佳实践是什么?
编辑
我搜索了这篇文章并发现了这篇文章http://goo.gl/2ZHal
本文说要设置基本的Rack身份验证,您不需要关心robots.txt.
我不知道基本的auth可以阻止谷歌机器人.似乎这个解决方案更好地操纵.gitignore文件.
在部署到Heroku时,我收到"错误:找不到模块"错误.
// package.json
{
"name": "AppName",
"version": "1.0.0",
"description": "== README",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "somerepo.git"
},
"author": "",
"license": "ISC",
"dependencies": {
"browserify": "^11.0.1",
"browserify-incremental": "^3.0.1",
"object-assign": "^3.0.0",
"react": "^0.13.3",
"react-image-gallery": "^0.4.1",
"reactify": "^1.1.1",
"superagent": "^1.3.0"
},
"devDependencies": {
"es6-promise": "^2.3.0"
}
}
Run Code Online (Sandbox Code Playgroud)
这是我运行"git push heroku master"时的日志
remote: -----> Build succeeded!
remote: ??? browserify@11.0.1
remote: ??? browserify-incremental@3.0.1
remote: ??? object-assign@3.0.0
remote: ??? react@0.13.3
remote: …Run Code Online (Sandbox Code Playgroud) 我在heroku上设置了asset_sync gem,遵循以下URL:https://github.com/rumblelabs/asset_sync
设置正常,我在S3上传了所有静态资产.
问题是,当我通过https协议打开页面时,无法访问任何资产,因为浏览器返回"This Connection is Untrusted".(与Chrome和Firefox相同).
在我承认访问s3资产网址后,每个资产都可以使用.https://myapp.asset.s3.amazonaws.com/assets
有人有同样的问题吗?如何解决这个问题?
我现在正在为我的 React 应用程序实现 Rails 之类的 Flash 消息。Flash 消息本身很好,但现在我希望 Flash 消息在某些页面中自动消失。我最初在我的 Flash 组件中使用了 setTimeout 但收到了这个错误。
未捕获错误:不变违规:enqueueCallback(...):您使用不可调用的回调调用了 setProps、replaceProps、setState、replaceState 或 forceUpdate。
这是代码。
import React from 'react/addons';
var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
class Flash extends React.Component {
constructor(props) {
super(props);
this.state = {
message: this.props.message
}
}
componentWillReceiveProps(nextProps) {
let _this = this;
this.setState({
message: nextProps.message
});
if (nextProps.autoDisappear) {
window.setTimeout(() => {
_this.setState({
message: null
}, 2000)
})
}
}
onClick(e) {
this.setState({
message: null
});
}
render() {
let transitionName = "flash-anim"
if …Run Code Online (Sandbox Code Playgroud)