# Discovery document is missing

**URL:** <https://meta.discourse.org/t/discovery-document-is-missing/279551>\
**Category:** SSO\
**Created:** [September 20, 2023, 6:19am UTC](https://meta.discourse.org/t/discovery-document-is-missing/279551 "2023-09-20T06:19:21Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![wayway\_way](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wayway_way/32/327018_2.png) [@wayway\_way](https://meta.discourse.org/u/wayway_way)\
**Post date:** [September 20, 2023, 6:19am UTC](https://meta.discourse.org/t/discovery-document-is-missing/279551/1 "2023-09-20T06:19:21Z")

</div>

Hi there,  
Discourse is currently the software that I think has the highest degree of technical freedom, so I chose it as my forum. But I encountered ‘Discovery document is missing’ error when configuring OIDC, which took me a week 😵‍💫, and I did not find a suitable solution here.  
I successfully built Discourse according to the following tutorial:

> [@Install Discourse for development using Docker](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009):
>
> Developing using Docker Since Discourse runs in Docker, you should be able to run Discourse directly from your source directory using a Discourse development container. white_check_mark Pros: No need to install any system dependencies, no configuration needed at all for setting up a development environment quickly. x Cons: Will be slightly slower than the native dev environment on Ubuntu, and much slower than a native install on MacOS. See also [Developing Discourse using a Dev Container](https://meta.discourse.org/t/developing-discourse-using-a-dev-container/336366) …

Then I used docker to build Keycloak, and both Keycloak and Discourse were deployed locally. When I established the connection of Discourse and keycloak through OIDC, I encountered the following error:

```plaintext

OIDC Log: Fetching discovery document raised error Faraday::ConnectionFailed FinalDestination: all resolved IPs were disallowed
1:51 pm
(oidc) Authentication failure! openid_connect_discovery_error: OmniAuth::OpenIDConnect::DiscoveryError, Discovery document is missing
1:51 pm
OmniAuth::OpenIDConnect::DiscoveryError (Discovery document is missing) lib/middleware/omniauth_bypass_middleware.rb:53:in `call' lib/content_security_policy/middleware.rb:12:in `call' lib/middleware/

```

According to this error I found the corresponding solution as follows:

> [@Openid-connect plugin can't fetch configuration](https://meta.discourse.org/t/openid-connect-plugin-cant-fetch-configuration/253728/2):
>
> There is a [security patch](https://github.com/discourse/discourse/blame/64171730827c58df26a7ad75f0e58f17c2add118/lib/final_destination/ssrf_detector.rb) that disallows reaching out to addresses in the private ranges (10.0.0.0/8 and so on) to prevent internal network explorations. You need to add the hostname to Admin - Settings - Security - allowed internal hosts to bypass the check. It would have been nice if the plugin did that for you.

After following the solution, a new error was reported as follows:

```plaintext
(oidc) Authentication failure! openid_connect_discovery_error: OmniAuth::OpenIDConnect::DiscoveryError, Discovery document is missing
2:00 pm
OmniAuth::OpenIDConnect::DiscoveryError (Discovery document is missing) lib/middleware/omniauth_bypass_middleware.rb:53:in `call' lib/content_security_policy/middleware.rb:12:in `call' lib/middleware/

```

Here are some of my configurations:

 ![image](https://global.discourse-cdn.com/meta/original/4X/3/0/6/30665b92ddd6ef31cd63c50f3b02d244073baf26.png)  
Keycloak’s port is 7070  
 ![image](https://global.discourse-cdn.com/meta/original/4X/1/d/5/1d56751c972b8c9695630da6dcb99e09f59a5191.png)

The contents of the openid connect discovery document are as follows

 ![image](https://global.discourse-cdn.com/meta/original/4X/1/d/e/1deddd3669f811ec23ff4c15c745bf98b865a781.png)

---

_[View the full topic](https://meta.discourse.org/t/discovery-document-is-missing/279551)._
