Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to set up configuration for dbfilter_from_header #2582

Open
AungKoKoLin1997 opened this issue Mar 15, 2023 · 2 comments
Open

Comments

@AungKoKoLin1997
Copy link
Contributor

AungKoKoLin1997 commented Mar 15, 2023

Hello Community, I am using odoo10 and I tried to used dbfilter_from_header module and I set up like documentation of this module.
I use the nginx in my server. I have multiple database and I want to setup domain for each database with dbfilter. But after I setup configuration for odoo.conf and nginx.conf, the url still points to database/selector page that mean my dbfilter is not working. Please someone point me out what's wrong with my configuration.
This is my nginx.conf.

# http -> https
server {
  listen 80;
  server_name test.odoo.com;
  rewrite ^(.*) https://$host$1 permanent;
}

server {
  listen 443 ssl;
  server_name test.odoo.com;

  include /etc/nginx/sites-available/conf.d/*.conf;
  proxy_set_header X-Odoo-dbfilter dbname;

  ssl_certificate /etc/letsencrypt/live/test.odoo.com/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/test.odoo.com/privkey.pem;

  # Redirect requests to odoo backend server
  location / {
    proxy_redirect off;
    proxy_pass http://127.0.0.1:8069;
  }
  location /longpolling {
    proxy_pass http://127.0.0.1:8072;
  }
  location /web/database {
    auth_basic "Restricted Content";
    auth_basic_user_file /etc/nginx/.htpasswd;
    proxy_pass http://127.0.0.1:8069;
    proxy_redirect off;
  }
}

In my odoo.conf, I don't add dbfilter parameter and add proxy_mode = True,
server_wide_modules = web,web_kanban,dbfilter_from_header.

I also tried to check this function

def db_filter(dbs, httprequest=None):
and I just noticed this function is not called when I run odoo server.

@RFoerster
Copy link

Hi - I'm having the same issue - did you find any solution to this? Thanks

@RFoerster
Copy link

RFoerster commented Sep 11, 2023

Hi,

I found a solution to this - proxy_set_header should not be placed in the main "server"-Element of the JSon-Config but rather in the location-part.

Looking at the config file of the thread-opener, it should be something like this:

# http -> https
server {
  listen 80;
  server_name test.odoo.com;
  rewrite ^(.*) https://$host$1 permanent;
}

server {
  listen 443 ssl;
  server_name test.odoo.com;

  include /etc/nginx/sites-available/conf.d/*.conf;


  ssl_certificate /etc/letsencrypt/live/test.odoo.com/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/test.odoo.com/privkey.pem;

  # Redirect requests to odoo backend server
  location / {
    proxy_redirect off;
    proxy_pass http://127.0.0.1:8069;
    proxy_set_header X-Odoo-dbfilter dbname;
  }
  location /longpolling {
    proxy_pass http://127.0.0.1:8072;
  }
  location /web/database {
    auth_basic "Restricted Content";
    auth_basic_user_file /etc/nginx/.htpasswd;
    proxy_pass http://127.0.0.1:8069;
    proxy_redirect off;
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants