Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn

由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

最新odoo12 nginx反向代理



  • 如下图,nginx设置proxy_set_header后,会出现

    2019-02-02 16:00:11,698 141152 WARNING goodman odoo.http: No CSRF validation token provided for path '/web/login'
    
    Odoo URLs are CSRF-protected by default (when accessed with unsafe
    HTTP methods). See
    https://www.odoo.com/documentation/12.0/reference/http.html#csrf for
    more details.
    
    * if this endpoint is accessed through Odoo via py-QWeb form, embed a CSRF
      token in the form, Tokens are available via `request.csrf_token()`
      can be provided through a hidden input and must be POST-ed named
      `csrf_token` e.g. in your form add:
    
          <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
    
    * if the form is generated or posted in javascript, the token value is
      available as `csrf_token` on `web.core` and as the `csrf_token`
      value in the default js-qweb execution context
    
    * if the form is accessed by an external third party (e.g. REST API
      endpoint, payment gateway callback) you will need to disable CSRF
      protection (and implement your own protection if necessary) by
      passing the `csrf=False` parameter to the `route` decorator.
                         
    2019-02-02 16:00:11,701 141152 WARNING goodman odoo.addons.website.models.ir_ui_view: Could not find view object with xml_id 'website.400'
    

    且无法登陆进去
    proxy_set_header配置为

    proxy_set_header Host $host;
    proxy_set_header X–Real–IP $remote_addr;
    proxy_set_header X–Forwarded–For $proxy_add_x_forwarded_for;
    proxy_set_header X–Forwarded–Proto $scheme;
    

    如果把proxy_set_header注释掉,nginx反向代理就可以访问,但是一修改头像就会提示 连接已丢失...重新连接,无法修改,而且没有修改头所有发送的连接仍是localhost或者是ip地址


  • Banned

    worker_processes 1;
    events {
    worker_connections 1024;
    }
    http {
         client_max_body_size     8m;
           client_body_buffer_size  128k;
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;
    gzip on;
    gzip_disable "msie6";
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    upstream odooserver{
    server 127.0.0.1:8069;
    }
    server {
    listen 80;
    server_name _;
    root /usr/lib/python3/dist-packages/odoo/addons;
    location /{
    proxy_pass http://odooserver;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass_header Set-Cookie;
    proxy_connect_timeout 60;
    proxy_send_timeout 60;
    proxy_read_timeout 3000;
    }
    }
    }


Log in to reply