Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How to set database filter on sub domain for odoo website using apache web server

Subscribe

Get notified when there's activity on this post

This question has been flagged
17 Replies
25547 Views
Avatar
Anil Kesariya

Hello Everyone,

Is it possible to filter database on single instance by defining server alias in apache configuration file?

I can achieve this by creating multiple sites configuration files and running multiple instance of opnerp server.

But I want that to be done by runnning single openerp instance. If anyone has idea regarding this will be appreciated.

Thank you.

Anil.

 

 

 

 

6
Avatar
Discard
Anil Kesariya
Author

Hi Anil, I assume that you have created the databases x2 already right? -- http://opensourceholic.com/2014/05/09/deploy-openerp-using-mod_proxy-and-mod_wsgi-on-linux-server/ The page above looks sound.. But haven't tested !!but i see??. v7: group.add_option("--db-filter", dest="dbfilter", default='.*', v8 / v9alpha: group.add_option("--db-filter", dest="dbfilter", my_default='.*', So Check versions, and wsgi config and other configs. and clearly the dB's need to be created first... Good Luck

Anil Kesariya
Author

@vee I already have more than two database. I don't want to config the openerp with wsgi. I have applied the filter pattern inside the config.py file. thanks for your comment.

Avatar
swapnil wagh
Best Answer

Hi Anil,
 

If you are working on local machine you should edit /etc/hosts with something like this:

127.0.0.1 foo.localhost

127.0.0.1 bar.localhost

where foo and bar are the db names.

Your virtual host file should look like this:

<VirtualHost *:80>

ServerName localhost

ServerAlias *.localhost // Use this if you want dbfillter on subdomain

ErrorLog /var/log/openerp/openerp-error.log

CustomLog /var/log/openerp/openerp-access.log combined

<Proxy *>

Order deny,allow

Allow from all

</Proxy>

ProxyRequests Off

ProxyPass / http://localhost:8069/

ProxyPassReverse / http://localhost:8069/

ProxyVia On

LogLevel warn

</VirtualHost>

After that  write dbfilter = ^%d$ in your openerp/tools/config.py file. After that restart apache2 and openerp.

In case you are doing all this on VPS and you bough a domain from domian provider, then you dont need to edit/etc/hosts file.

You can read a blog post for more information : http://goo.gl/1Ub8sc

7
Avatar
Discard
Anil Kesariya
Author

Hello Swapnil Thank I appreciate response. I have followed your step but couldn't achieved my requirements. Its redirect me to create new database page in any domain.

Anil Kesariya
Author

@vee I already have more than two database. I don't want to config the openerp with wsgi. I have applied the filter pattern inside the config.py file. thanks for your comment.

swapnil wagh

@Anil Can you give me some more details for better understanding your issue, Are you working on local machine? Can you share your Apache configuration and openerp configuration?

Anil Kesariya
Author

@Swapnil Yes I am working on local machine. I have gone through all the step you mention. I can login through applied domain on virtual host. only remaining portion is to set sub domain for database.

swapnil wagh

@Anil, did you create two entries like 127.0.0.1 foo.localhost 127.0.0.1 bar.localhost replace foo and bar with your two database names, on local you can't use serverAlise for subdomain, use foo.localhost.com as servername then change db-filter in openerp/tools/config.py to %d. It should work I personally when I deploy openerp.

Anil Kesariya
Author

@sapanil. Previously i used server alias for sub domain. I replaced with the specific subdomain. still having same screen of manage database.

OdooBot
@Anil,

Do you really have a database on server please check the db user might be you have db but the owner is different than what you have in openerp config, odoo redirect you to database manager page only when you don't have db single db created on server.

On Wed, Oct 15, 2014 at 11:03 AM, Anil Kesariya <a.kesariya.serpentcs@mail.odoo.com> wrote:

@sapanil. Previously i used server alias for sub domain. I replaced with the specific subdomain. still having same screen of manage database.

--
Anil Kesariya
Sent by Odoo Inc. using Odoo about Forum Post False

Anil Kesariya
Author

@swapnil I am not using service file to start openerp server. my openerp server is running manually.

Anil Kesariya
Author

@swapnil I have gone through the main db filter method which is defined in openerp/http.py . In that method it using the httprequest.environ.get('HTTPHOST', '').split(':')[0] which should return the domain passed on browser. instead domain i am getting the ip address 127.0.0.1 and this value is manipulated get database. instead i modified the method and applied HTTP_X_FORWARDED_HOST instead HTTP_HOST h = httprequest.environ.get('HTTP_X_FORWARDED_HOST', '').split(':')[0] than it returns me the exact domain name eg. subdomain.localhost.com so it filter the correct data and return the filtered database list and works well. is it correct method to modified the code of odoo? or am I forgot anything to configure?

swapnil wagh

@Anil What you did is also ok, but when we use %d for db-filter in configuration it works, but as its filter the database it matches the subdoamin means if you have db like anil1 , anil2 and odoo and you use anil.domain.com it will show both db starts with anil except odoo in dropdown. So what you did is correct to get out from this issue. If you need any help from me I can help you to solve your subdomain issue.

Anil Kesariya
Author

Thanks sure.

Avatar
Sarl
Best Answer

Hi all,

May be this help you.

We find a solution for use %h and subdomain, create your db in replace '.' by '-'.

Example : for the domaine erp.pharmacy.com, create db erp-pharmacy-com

And in your file .conf, at line dbfilter, write this : dbfilter = %h

Works for Odoo v8

2
Avatar
Discard
Avatar
abraham
Best Answer

Header add X-ODOO_DBILTER "db-name"

RequestHeader add X-ODOO_DBFILTER "db-name"

please add these in apache2 configuration file to filter database

0
Avatar
Discard
Avatar
Shivam Mahajan
Best Answer

Can you please    tell me how to configure multi domains foe multi companies in odoo9.........the help would be appreciated

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now