# Discourse headless?

**URL:** https://meta.discourse.org/t/discourse-headless/137893
**Category:** Self-hosting
**Created:** [January 6, 2020, 5:28pm UTC](https://meta.discourse.org/t/discourse-headless/137893 "2020-01-06T17:28:52Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jamesmarkcook](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesmarkcook/32/168563_2.png) [@jamesmarkcook](https://meta.discourse.org/u/jamesmarkcook)
#### Post date: [January 6, 2020, 5:28pm UTC](https://meta.discourse.org/t/discourse-headless/137893/1 "2020-01-06T17:28:53Z")

</div>

Is it possible to run Discourse in a headless mode i.e. without the Ember frontend?

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [January 6, 2020, 5:30pm UTC](https://meta.discourse.org/t/discourse-headless/137893/2 "2020-01-06T17:30:15Z")

</div>

Recategorizing to #installation as this definitely isn’t a frequently asked question.

Could you elaborate on your use case?

---

<div class="post-metadata">

### Author: ![jamesmarkcook](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesmarkcook/32/168563_2.png) [@jamesmarkcook](https://meta.discourse.org/u/jamesmarkcook)
#### Post date: [January 6, 2020, 5:32pm UTC](https://meta.discourse.org/t/discourse-headless/137893/3 "2020-01-06T17:32:31Z")

</div>

We have a React frontend consuming the Discourse API. We also have our own plugin extending Discourse features for some specific use cases.

If users visit our ‘API’ url then they currently see the unbranded Discourse Ember frontend. Ideally we’d like to turn that off.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [January 6, 2020, 6:36pm UTC](https://meta.discourse.org/t/discourse-headless/137893/4 "2020-01-06T18:36:32Z")

</div>

I would make my custom app set a custom header when calling the Discourse API, and add a small rule on the internal Discourse nginx to 403 all requests without the special header.

---

<div class="post-metadata">

### Author: ![jamesmarkcook](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesmarkcook/32/168563_2.png) [@jamesmarkcook](https://meta.discourse.org/u/jamesmarkcook)
#### Post date: [January 7, 2020, 9:04am UTC](https://meta.discourse.org/t/discourse-headless/137893/5 "2020-01-07T09:04:54Z")

</div>

Thanks for the suggestion @Falco. What would be the best way to do this whilst still using the official Discourse docker images?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [January 8, 2020, 1:02am UTC](https://meta.discourse.org/t/discourse-headless/137893/6 "2020-01-08T01:02:23Z")

</div>

You can do the necessary mangling on your app.yml file.

The app.yml file you have now should be ending like this:

```yaml
run:
  - exec: echo "Beginning of custom commands"
  ## blablabla
  - exec: echo "End of custom commands"

```

You can run replaces in the nginx file making it look like this

```yaml
run:
  - exec: echo "Beginning of custom commands"
  ## blablabla
  - replace:
     filename: "/etc/nginx/conf.d/discourse.conf"
     from: "location @discourse {"
     to: |
       location @discourse {
       add_header AAA bbb;
  - exec: echo "End of custom commands"

```

There are several examples at [discourse\_docker/templates at master · discourse/discourse\_docker · GitHub](https://github.com/discourse/discourse_docker/tree/master/templates)

---

<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: [February 7, 2020, 1:02am UTC](https://meta.discourse.org/t/discourse-headless/137893/7 "2020-02-07T01:02:36Z")

</div>

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