Discourse headless?

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

1 Like

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

Could you elaborate on your use case?

3 Likes

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.

3 Likes

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.

12 Likes

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

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

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

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

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 https://github.com/discourse/discourse_docker/tree/master/templates

4 Likes

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