# \[HELP\] ログインできません、「BAD CSRF」というエラーが表示されます

**URL:** https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424
**Category:** Support
**Created:** [2016 年 11 月 3 日午前 9:08 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424 "2016-11-03T09:08:33Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![lifehome](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lifehome/32/120752_2.png) [@lifehome](https://meta.discourse.org/u/lifehome)
#### Post date: [2016 年 11 月 3 日午前 9:08 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/1 "2016-11-03T09:08:33Z")

</div>

みなさん、こんにちは。

Discourse をサーバーにインストールし、これまで問題なく長く運用していましたが、最新のアップデート以降、管理者アカウントを含むすべてのユーザーがログインできなくなっています。

しばらくして、これはプラグインの問題ではないかと疑い、すべてのプラグインを削除した後、`./launcher rebuild app` を実行して純粋なバニラ版で再起動しましたが、効果はありませんでした。現在の状況では、サイトが読み取り専用モードになっており、スレッドの閲覧以外に何らかのアクションを実行できないようです。

ログインフォームを送信すると、以下のエラーが表示されますが、その意味がわかりません。

 ![](https://global.discourse-cdn.com/meta/original/4X/1/9/3/1932c23a3482c0c10755c42cf8ce858972e6363c.png)

サイトは [https://discuss.stickyricelove.com](https://discuss.stickyricelove.com) にあります。私たちは香港で思春期の青少年向けに性教育を普及・促進し、彼らの疑問や悩みを解決する非営利団体です。

できるだけ早くご回答いただければ幸いです。😩😭  
よろしくお願いいたします。

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016 年 11 月 3 日午前 9:57 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/2 "2016-11-03T09:57:41Z")

</div>

It looks like one of your plugins is not compatible with the current version of Discourse. I suggest removing all third party (non-official) plugins and rebuilding.

---

<div class="post-metadata">

### Author: ![lifehome](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lifehome/32/120752_2.png) [@lifehome](https://meta.discourse.org/u/lifehome)
#### Post date: [2016 年 11 月 4 日午前 4:02 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/3 "2016-11-04T04:02:52Z")

</div>

It is already a clean build without plugins, only with the docker\_manager. Should I remove that too?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016 年 11 月 4 日午前 4:08 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/4 "2016-11-04T04:08:04Z")

</div>

Hmm, did you try upgrading at the command line?

Please SSH into your server and run:

```plaintext
cd /var/discourse
git pull
./launcher rebuild app

```

---

<div class="post-metadata">

### Author: ![lifehome](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lifehome/32/120752_2.png) [@lifehome](https://meta.discourse.org/u/lifehome)
#### Post date: [2016 年 11 月 4 日午前 4:11 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/5 "2016-11-04T04:11:35Z")

</div>

I have already tried this many many times, and it still shows the same error.

> I’m now removing the docker\_manager and rebuilding it.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016 年 11 月 4 日午前 4:14 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/6 "2016-11-04T04:14:58Z")

</div>

Is this an install that followed our [official install](https://meta.discourse.org/t/142537?silent=true) guide? Any errors in the rebuild?

---

<div class="post-metadata">

### Author: ![lifehome](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lifehome/32/120752_2.png) [@lifehome](https://meta.discourse.org/u/lifehome)
#### Post date: [2016 年 11 月 4 日午前 4:15 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/7 "2016-11-04T04:15:43Z")

</div>

Yes I have followed the exact steps carefully, and it’s a “no” for the errors. It builds smoothly that I can’t even tell what has gone wrong.

Will extract the backups and rebuild the VPS if nothing works out today. 😭

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016 年 11 月 4 日午前 4:17 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/8 "2016-11-04T04:17:27Z")

</div>

Do you have this behind cloudflare or anything like that? @sam do you see anything in the pictured JS console errors that would indicate what is the issue?

---

<div class="post-metadata">

### Author: ![lifehome](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lifehome/32/120752_2.png) [@lifehome](https://meta.discourse.org/u/lifehome)
#### Post date: [2016 年 11 月 4 日午前 4:19 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/9 "2016-11-04T04:19:54Z")

</div>

We have consider that issue too, therefore a month ago we completely disabled all Cloudflare features, will also consider moving out Cloudflare since it brings enough troubles for us.

Will there be any override that I can force my current session as an admin? In that way I can get into the backend and see what’s the log telling 😟

---

<div class="post-metadata">

### Author: ![stephane](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@stephane](https://meta.discourse.org/u/stephane)
#### Post date: [2016 年 11 月 4 日午前 4:37 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/10 "2016-11-04T04:37:49Z")

</div>

Hello,

I manage a small discourse forum for an opensource project and we have something that looks like the same problem. The error is exactly the same with google chrome, but is different with firefox : the login dialog works normally, the page is refreshed but it does not log me in (screenshots bellow).

It’s a dedicated host, and it doesn’t change much if I rebuild with beta, previous beta, or “tests-passed”. We don’t use cloudfare, but it’s behind a nginx reverse proxy (nothing too fancy). The discourse container is http, but nginx serves it in https through the reverse proxy, if that makes any difference.

I would appreciate any idea if there is something I can try.

Regards,

Stephane

 ![](https://global.discourse-cdn.com/meta/original/3X/7/e/7e63b23a6f496c94f0f277a526c6f256417ee670.png)

 ![](https://global.discourse-cdn.com/meta/original/3X/4/a/4a44343a6320fa996f9392f8688f8c3dc21d18a4.png)

---

<div class="post-metadata">

### Author: ![lifehome](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lifehome/32/120752_2.png) [@lifehome](https://meta.discourse.org/u/lifehome)
#### Post date: [2016 年 11 月 4 日午前 5:22 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/11 "2016-11-04T05:22:45Z")

</div>

@codinghorror @sam Will that be an upstream bug?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016 年 11 月 4 日午前 5:31 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/12 "2016-11-04T05:31:07Z")

</div>

We have no repro of this, so it is likely something about your local setup.

---

<div class="post-metadata">

### Author: ![lifehome](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lifehome/32/120752_2.png) [@lifehome](https://meta.discourse.org/u/lifehome)
#### Post date: [2016 年 11 月 4 日午前 7:50 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/13 "2016-11-04T07:50:56Z")

</div>

VPS を再構築し、新しい Discourse インストールを実行しています。その際、以下が発生し、しばらくフリーズしました：

 ![](https://global.discourse-cdn.com/meta/original/4X/0/3/c/03c402980486df700955fd423b1b147671ef2c7d.png)

---

<div class="post-metadata">

### Author: ![Firei](https://avatars.discourse-cdn.com/v4/letter/f/91b2a8/32.png) [@Firei](https://meta.discourse.org/u/Firei)
#### Post date: [2016 年 11 月 5 日午後 2:01 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/14 "2016-11-05T14:01:01Z")

</div>

Is there a solution? We have the same problem…

---

<div class="post-metadata">

### Author: ![lifehome](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lifehome/32/120752_2.png) [@lifehome](https://meta.discourse.org/u/lifehome)
#### Post date: [2016 年 11 月 5 日午後 2:17 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/15 "2016-11-05T14:17:15Z")

</div>

It appears to us an upgrade issue. We have backup away the data, and performed a clean install and backup restoration.

However other than that, I have no idea what caused this issue.

---

<div class="post-metadata">

### Author: ![stephane](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@stephane](https://meta.discourse.org/u/stephane)
#### Post date: [2016 年 11 月 6 日午後 6:11 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/16 "2016-11-06T18:11:29Z")

</div>

Hello. I tried to run it without the nginx reverse proxy and it did not resolve the issue. Will run a reinstall tomorrow except if anyone think about something that could help by that time.

I noticed that by default, the launcher rebuild script was checking out the “tests-passed” version. Is it a bit dangerous ? should it be beta ? When I update from the admin web screen, it update to the most recent beta instead ?

I had to launch a rebuild before the problem appeared because the host ip from inside the container changed. The host is also my mailserver, and the mail config was in app.yml.

Is it possible that with the rebuild, I updated to a version that somehow corrupted the config ? (I launched the rebuild around 11/02/2016 07:00 PM if that’s any help).

Regards,

Stephane

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2016 年 11 月 7 日午前 12:15 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/17 "2016-11-07T00:15:46Z")

</div>



---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2016 年 11 月 7 日午前 4:23 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/18 "2016-11-07T04:23:35Z")

</div>



---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2016 年 11 月 7 日午前 4:24 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/19 "2016-11-07T04:24:12Z")

</div>

In future if you feel your issue was not resolved, flag to reopen topic and DON’T accept an answer on the topic.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2016 年 11 月 7 日午前 4:25 UTC](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424/20 "2016-11-07T04:25:17Z")

</div>

If you are running a reverse proxy 99.999% the issue is that you are not passing headers right to discourse.

> [@Error 403 when trying to add articles or change any options](https://meta.discourse.org/t/error-403-when-trying-to-add-articles-or-change-any-options/52491/13):
>
> Holy moly, finally! I need to add a simple line to my nginx config: proxy\_set\_header X-Forwarded-Proto https; Who could guess that? So thank you and see you!

[次のページ](https://meta.discourse.org/t/help-cannot-login-error-shows-bad-csrf/52424.md?page=2)
