Skip to Content
Menu
This question has been flagged
1 Reply
1758 Views

Hi,


Does the x-sendfile option only works for files included in the filestore, or is it also used for example static files in odoo modules ?


This is an important question for containerized odoo deployments.  Mounting the filestore from odoo environment inside the nginx container is something that can be done.  Having the addons which typically reside inside the container, available for nginx is more difficult.


Tnx

Avatar
Discard
Best Answer

--x-sendfile cli flag is only meant for the 'filestore' folder. 
This flag is for odoo to do some permission check before handing out the file, while servering those 'attachments' over your reverse proxy. 

Typically like this:

in your systemd service file, add --x-sendfile flag the the exec line as cli flag. 

in your Nginx config file, add 

location /web/filestore {
    internal;
    alias /opt/odoo/.local/share/Odoo/filestore;
}

I believe Nginx shall have read access to this path. The sub path inside filestore folder does not match the request uri as the file path and actual uri would be dynamically mapped by odoo after doing permission check. 

While for  static files, it is servering them via Nginx directly without permission check by odoo. 
You would do something like this:

location @odoo {
    # copy-paste the content of the / location block
}

# Serve static files right away
location ~ ^/[^/]+/static/.+$ {
    root /opt/odoo;
    try_files /community/odoo/addons$uri /community/addons$uri /enterprise$uri @odoo;
    expires 24h;
}

When your addon path is like

/opt/odoo/community/odoo/addons,/opt/odoo/community/addons,/opt/odoo/enterprise

And yes, Nginx needs read access to those paths. 

Reference:

https://www.odoo.com/documentation/16.0/administration/install/deploy.html#serving-static-files-and-attachments  (there's some errors in this link)


Avatar
Discard
Related Posts Replies Views Activity
8
Oct 24
15947
0
Oct 22
2684
3
Nov 24
2945
5
Nov 24
7451
2
Oct 24
2882