Hello.
We have a v2.4.0.beta2 +346 Discourse installation that was originally available at include.metaring.com
,
using Apache HTTP Server on Ubuntu that:
- Redirects all HTTP requests to HTTPS
- Manages by itself the SSL certificate (LetsEncrypt)
- All requests were redirected by Proxy to using nginx http sock, so Discourse Docker ports 80 and 443 are disabled/unused
We did
./launcher enter app
rails c
[1] pry(main)> SiteSetting.force_https = true
=> true
To be extremely sure that everything was served in HTTPS (we had several errors if not)
And everything was working fine.
Then we decided to move the application (without touching DB or other stuff) under include.metaring.com/
discourse, so we edited the app.yml file like this:
-
DISCOURSE_HOSTNAME: include.metaring.com
<— Untouched, same as before DISCOURSE_RELATIVE_URL_ROOT: /discourse
Then, to be extremely sure, we did:
./launcher stop app
./launcher destroy app
./launcher cleanup
./launcher rebuild app
Of course we also inserted in Apache config file the rules to correctly ProxyPass from /discourse to unix:/…/…/nginx.http.sock|http://localhost/discourse
After this, the application was of course online, but had a lot of problems:
-
All static content stuff (plugins, assets, images, javascripts, uploads) weren’t available. After long debug sessions and non-fruitful web searches for letting them work we created some proxy rules in Apache to tunnel them to the root localhost path, without the /discourse prefix (eg. /disourse/plugins points to -> unix:/…/…/nginx.http.sock|http://localhost/plugins and so on)
-
Some /uploads paths came from web pages without the /discourse prefix, so we needed to write another Apache proxy rule that moves from /uploads/ to unix:/…/…/nginx.http.sock|http://localhost/discourse/uploads
-
Now the most strange thing: when the client sends requests containing /uploads/default/ or /discourse/uploads/default/ (static content) we need to follow the solution at point 1 described before and redirect them both to
http://localhost/uploads/default/
(without the /discourse prefix), while other /uploads/ or /discourse/uploads/ requests that don’t contain /default prefix in path must be redirected tohttp://localhost/discourse/uploads/
(noticed that without the default path means that they are webservices calls)
With all these 9 proxy rules we inserted everything works fine again even under the /discourse path. But we found extremely strange that we needed to write all this stuff to let everything work again.
Are we doing something wrong?
Is there any other smart method to manage this situation?
=== EDIT ===
Forgot another thing that is maybe linked:
When the user tries to upload a custom picture to use as personal avatar, the upload goes OK and the miniature of the picture is correctly shown.
But when the Save changes button is pressed and the page is reloaded, the avatar comes back to the default user avatar
Checking the produciton.log
file, it shows that the error is Code 418
.
Other picture uploads work well.
Thanks in advance for responses and for your amazing work!