Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
3081 Prikazi

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
Opusti
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
Opusti
Related Posts Odgovori Prikazi Aktivnost
9
apr. 25
27027
0
okt. 22
4212
3
avg. 25
2502
1
maj 25
2585
1
apr. 25
3553