# 새 커뮤니티를 스테이징하면 WP-Discourse 플러그인이 Basic Auth로 인해 오류 발생

**URL:** https://meta.discourse.org/t/staging-a-new-community-basic-auth-breaks-wp-discourse-plugin/352368
**Category:** WordPress
**Created:** [2월 14, 2025, 8:13오후 UTC](https://meta.discourse.org/t/staging-a-new-community-basic-auth-breaks-wp-discourse-plugin/352368 "2025-02-14T20:13:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Todd\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/todd_s/32/484575_2.png) [@Todd\_S](https://meta.discourse.org/u/Todd_S)
#### Post date: [2월 14, 2025, 8:13오후 UTC](https://meta.discourse.org/t/staging-a-new-community-basic-auth-breaks-wp-discourse-plugin/352368/1 "2025-02-14T20:13:37Z")

</div>

WP-Discourse 플러그인을 사용하여 WordPress와 Discourse 사이트(자체 호스팅)를 스테이징 환경에 구축하고 있습니다.

두 사이트 모두 HTTP 기본 인증을 성공적으로 활성화하여, 공개가 준비될 때까지 외부에서 접근할 수 없도록 설정했습니다(일반 대중은 물론 검색 엔진의 접근도 사실상 차단).

**WordPress (비슷한 작업을 수행하려는 분들을 위한 참고 정보)**

- 사용자 및 해당 비밀번호를 포함한 `.htpasswd` 파일 생성
- `.htaccess` 파일에 인증 섹션 추가
- 예시 가이드: [Password protecting your site with an .htaccess file — DreamHost Knowledge Base](https://help.dreamhost.com/hc/en-us/articles/216363187-Password-protecting-your-site-with-an-htaccess-file)

**Discourse**

- `app.yml`을 수정하기 위해 다음 단계를 따름: [Restrict access to your Discourse site with HTTP Basic Authentication](https://meta.discourse.org/t/restrict-access-to-your-discourse-site-with-http-basic-authentication/168192)
- 구성 재빌드: `/var/discourse# ./launcher rebuild app`

WP-Discourse 플러그인은 Discourse 서버에서 기본 인증이 활성화되기 전까지는 잘 작동합니다.

(수정) WordPress 측 WP-Discourse 플러그인 로그에서 발생하는 오류는 다음과 같습니다: `[2025-02-14 18:20:06] connection.INFO: check_connection_status.failed_to_connect {"error":"wpdc_response_error","message":"An invalid response was returned from Discourse","http_code":401,"http_body":"<html>\r\n<head><title>401 Authorization Required</title></head>\r\n<body>\r\n<center><h1>401 Authorization Required</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n"}`

Discourse에서 API에 대해 HTTP 기본 인증 요구를 제외하는 방법에 대해 어떤 아이디어가 있을까요?

감사합니다!

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2월 14, 2025, 8:22오후 UTC](https://meta.discourse.org/t/staging-a-new-community-basic-auth-breaks-wp-discourse-plugin/352368/2 "2025-02-14T20:22:18Z")

</div>

> [@Todd\_S](#):
>
> 양쪽에 HTTP Basic Authentication을 성공적으로 활성화했습니다.

정말 그렇게 하셨나요? Discourse가 basic auth 뒤에 작동하는지 확신이 서지 않습니다. 한 번 시도해 보았지만 포기했습니다. wp-discourse가 깨질 가능성이 더 높아 보입니다(아, 제 추측이 맞았네요!). 성공하셨다면 이 메시지를 쓰지 않으셨을 것입니다. 😉

Discourse 스테이징 사이트의 경우, 일반적으로 "로그인 필요"를 설정하여 검색 엔진을 차단합니다. 로그인 권한이 있는 사람은 여전히 로그인할 수 있지만, 보통 이것이 원하는 동작입니다.

사이트가 누구나 접근할 수 있는 것이 허용되지 않는다면, 방화벽을 사용하여 IP로 접근을 제한하는 것이 좋습니다.

> [@Todd\_S](#):
>
> Discourse에서 API에 대한 HTTP Basic Authentication 요구를 제외하는 방법에 대해 의견이 있으신가요?

basic auth에 Discourse 서버의 IP에서 접근을 허용하도록 설정할 수 있을까요? 아마 이렇게 될 수 있습니다: [Allow access from one IP, require basic auth from all other sources - Traefik v2 - Traefik Labs Community Forum](https://community.traefik.io/t/allow-access-from-one-ip-require-basic-auth-from-all-other-sources/13098)

---

<div class="post-metadata">

### Author: ![Todd\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/todd_s/32/484575_2.png) [@Todd\_S](https://meta.discourse.org/u/Todd_S)
#### Post date: [2월 15, 2025, 6:04오전 UTC](https://meta.discourse.org/t/staging-a-new-community-basic-auth-breaks-wp-discourse-plugin/352368/3 "2025-02-15T06:04:05Z")

</div>

> [@pfaffman](#):
>
> 기본 인증을 설정하여 Discourse 서버의 IP 주소에서 접근을 허용할 수 있나요?

감사합니다. 이 단서가 문제를 해결하는 데 도움이 되었습니다. 제 Discourse 서버의 `app.yml`에서 업데이트된 기본 인증(basic auth) 섹션은 다음과 같습니다 (Wordpress 서버에서는 변경 사항이 필요하지 않았습니다):

```plaintext
# basic auth
  after_bundle_exec:
    - replace:
       filename: "/etc/nginx/conf.d/discourse.conf"
       from: "# Allow bypass cache from localhost"
       to: |
            # Allow bypass basic authentication for WP-Discourse plugin
            geo $authentication {
            default "Credentials you must provide.";
            127.0.0.1 "off";
            151.101.3.55/32 "off";
            }
            # Allow bypass cache from localhost
    - replace:
       filename: "/etc/nginx/conf.d/discourse.conf"
       from: "# auth_basic on"
       to: "auth_basic $authentication"
    - replace:
       filename: "/etc/nginx/conf.d/discourse.conf"
       from: "# auth_basic_user_file /etc/nginx/htpasswd"
       to: "auth_basic_user_file /etc/nginx/htpasswd"
    - replace:
       filename: "/etc/nginx/conf.d/discourse.conf"
       from: "location = /srv/status {"
       to: "location = /srv/status {
           auth_basic off;"
    - file:
       path: "/etc/nginx/htpasswd"
       contents: |
         alfred:$apr1$jSdLuHyZ$faWxYGjnmLd/zRC6UMsRs1

```

`151.101.3.55`는 제 Wordpress 서버의 (예시) 공용 IP 주소입니다. 이제 WP-Discourse는 다음과 같이 보고합니다:  
 ![A blank screen displays the green-bordered text, "You are connected to Discord!" (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/d/d/e/ddee353078be2b34e77121a5c7fe4550e50d0cdb.png)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [3월 17, 2025, 6:04오전 UTC](https://meta.discourse.org/t/staging-a-new-community-basic-auth-breaks-wp-discourse-plugin/352368/4 "2025-03-17T06:04:43Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
