Discourse Rails as a proxy

AI 生成的摘要

EndruK proposes using Discourse as a proxy to wrap external web applications, aiming to help startups quickly publish apps with integrated user management and authentication via plugins. While they successfully forward HTTP responses to the Ember frontend, they face challenges in correctly linking static dependencies like images and stylesheets so they appear to originate from the Rails server root. eviltrout questions the necessity of this approach, suggesting that route forwarding is better handled by a reverse proxy like Nginx before reaching Rails. EndruK clarifies their vision of registering app routes within a Discourse plugin to render content inside the forum. eviltrout responds that this use case diverges from Discourse’s intended design, noting the significant complexity involved in synchronizing routes on both the Ember and server sides while maintaining a proxy setup, a pattern the core team has never implemented.

Hi,
I want to use my Discourse as a proxy.
For that the rails server should work as a proxy between the ember frontend and a registered remote URL.

Currently I am able to forward the HTTP response to ember and render it there.
But now I got some problems linking additional dependencies like images or stylesheets (all the stuff of the web root)

Here is an example flow diagram:

How can I make a link to these things such that the dependencies appear to be on my rails server for example in the web root?

Best regards.

My first question is why? What are you trying to achieve here?

If you only need to forward certain routes, that’s more easily done in nginx or something that happens before your rails server is hit.

Hi Robin, thanks for your answer.
I want to use Discourse as a wrapper for web applications. I thought this would be nice for startups in order to publish their web applications faster without wasting their time on user management, additional forum, social network and authentication.
The idea was to register the routes of your web application in a discourse plugin and render the content of the app inside discourse.

It sounds like you’re trying to make Discourse do something it wasn’t designed to do. You’d have to register the routes in the ember side as well as the server side, plus have the server side set up a proxy. We’ve never done something like that before.