mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
discourse: Don't patch the public path
Instead of patching the path to /public in Discourse's sources, make the nginx configuration refer to the symlink in the discourse package which points to the real path. When there is a mismatch between the path nginx serves and the path Discourse thinks it serves, we can run into issues like files not being served - at least when sendfile requests from the ruby app are processed by nginx. The issue I ran into most recently is that backup downloads don't work. Since Discourse refers to the public directory relative to the Rails root in many places, it's much easier to just sync this path to the nginx configuration than trying to patch all occurrences in the sources. This should hopefully mean less potential for breakage in future Discourse releases, too.
This commit is contained in:
parent
4fb343c87e
commit
125bb7dac1
3 changed files with 4 additions and 22 deletions
|
@ -841,7 +841,7 @@ in
|
|||
inherit (cfg) sslCertificate sslCertificateKey enableACME;
|
||||
forceSSL = lib.mkDefault tlsEnabled;
|
||||
|
||||
root = "/run/discourse/public";
|
||||
root = "${cfg.package}/share/discourse/public";
|
||||
|
||||
locations =
|
||||
let
|
||||
|
@ -893,7 +893,7 @@ in
|
|||
"~ ^/uploads/" = proxy {
|
||||
extraConfig = cache_1y + ''
|
||||
proxy_set_header X-Sendfile-Type X-Accel-Redirect;
|
||||
proxy_set_header X-Accel-Mapping /run/discourse/public/=/downloads/;
|
||||
proxy_set_header X-Accel-Mapping ${cfg.package}/share/discourse/public/=/downloads/;
|
||||
|
||||
# custom CSS
|
||||
location ~ /stylesheet-cache/ {
|
||||
|
@ -915,7 +915,7 @@ in
|
|||
"~ ^/admin/backups/" = proxy {
|
||||
extraConfig = ''
|
||||
proxy_set_header X-Sendfile-Type X-Accel-Redirect;
|
||||
proxy_set_header X-Accel-Mapping /run/discourse/public/=/downloads/;
|
||||
proxy_set_header X-Accel-Mapping ${cfg.package}/share/discourse/public/=/downloads/;
|
||||
'';
|
||||
};
|
||||
"~ ^/(svg-sprite/|letter_avatar/|letter_avatar_proxy/|user_avatar|highlight-js|stylesheets|theme-javascripts|favicon/proxied|service-worker)" = proxy {
|
||||
|
@ -942,7 +942,7 @@ in
|
|||
};
|
||||
"/downloads/".extraConfig = ''
|
||||
internal;
|
||||
alias /run/discourse/public/;
|
||||
alias ${cfg.package}/share/discourse/public/;
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue