Skip to content

Commit

Permalink
docs: turn off safe write in Jetbrains softwares (#614)
Browse files Browse the repository at this point in the history
close #428
  • Loading branch information
shaoshuai0102 authored and fengmk2 committed Mar 22, 2017
1 parent 2296b7b commit c22e005
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/source/en/faq.md
Expand Up @@ -50,3 +50,14 @@ There are two kinds of common csrf errors:
By default [egg-security](https://github.com/eggjs/egg-security/) plugin built in Egg requires CSRF validation against all 'unsafe' request such as `POST`, `PUT`, `DELETE` requests.

The error will disappear in the presence of correct csrf token in request. For more implentation details, see [./core/security.md#csrf].

## In local development environment, why is worker process not restarted automatically when files are modified?

Usually this happens when you are using Jetbrains softwares(IntelliJ IDEA, WebStorm, etc.) with `Safe Write` turned on.

According to Jetbrains [Safe Write document](https://www.jetbrains.com/help/webstorm/2016.3/system-settings.html):

> If this check box is selected, a changed file is first saved in a temporary file. If the save operation succeeds, the file being saved is replaced with the saved file. (Technically, the original file is deleted and the temporary file is renamed.)
Renaming files leads to file watching failure. The solution is simple: just turn of `Safe Write` option. (Settings | Appearance & Behavior | System Settings | Use "safe write", the path may vary in different versions)

10 changes: 10 additions & 0 deletions docs/source/zh-cn/faq.md
Expand Up @@ -52,3 +52,13 @@ pm2 start server.js
Egg 内置的 [egg-security](https://github.com/eggjs/egg-security/) 插件默认对所有『非安全』的方法,例如 `POST``PUT``DELETE` 都进行 CSRF 校验。

请求遇到 csrf 报错通常是因为没有加正确的 csrf token 导致,具体实现方式,请阅读[安全威胁 CSRF 的防范](./core/security.md#安全威胁csrf的防范)

## 本地开发时,修改代码后为什么 worker 进程没有自动重启?

没有自动重启的情况一般是在使用 Jetbrains 旗下软件(IntelliJ IDEA, WebStorm..),并且开启了 Safe Write 选项。

Jetbrains [Safe Write 文档](https://www.jetbrains.com/help/webstorm/2016.3/system-settings.html)中有提到:

> If this check box is selected, a changed file is first saved in a temporary file. If the save operation succeeds, the file being saved is replaced with the saved file. (Technically, the original file is deleted and the temporary file is renamed.)
由于使用了重命名导致文件监听的失效。解决办法是关掉 Safe Write 选项。(Settings | Appearance & Behavior | System Settings | Use "safe write" 路径可能根据版本有所不同)

0 comments on commit c22e005

Please sign in to comment.