Why am I getting an "Internal Server Error" starting two instances of Odoo (same domain, but different ports)?

I have two Odoo instances on a server in the cloud. If I do the following steps, I will get an "Internal Server Error":

  • I do login in the first instance ( http://111.222.33.44:3333 { http://111.222.33.44:3333 )
  • Close session
  • I load the address of the second instance into the same browser ( http://111.222.33.44:4444 )

If I want to work in the second instance (in a different port), I first need to delete the browser cookies in order to access another instance of Odoo. If all this works fine.

If I download them in different browsers (Firefox and Chromium) at the same time, they work well.

This is not a NginX problem, because I tried with it and without it.

Is there any way to solve this problem forever? Is this expected behavior?

+6
source share
4 answers

Finally, I think this is the expected behavior. Cookies for all websites are stored specifically for each website (for each domain) in a web browser. Therefore, if I only change the port, the cookies of the first instance conflict with the cookies of the other instance, because they have the same domain ( 111.222.33.44 in my example).

So there are some workarounds:

Change local domain

Creating a pair of domain names in my laptop in /etc/hosts :

 111.222.33.44 cloud01 111.222.33.44 cloud02 

Then, cookies no longer interfere with each other. To access each instance

 http://cloud01:3333 http://cloud02:4444 

Broswer extension. Multilogin or Multiaccount

There is another workaround. If I use this chrome extension, the problem disappears because the sessions are processed separately:

0
source

If you have access to the source code, you can modify this file as shown below and check if the problem is resolved.

add-ons / web / controllers / main.py

 if db != request.session.db: request.session.logout() request.session.db = db abort_and_redirect(request.httprequest.url) 

And delete -> request.session.db = db

which is below this IF statement .

0
source

Try the following changes:

OpenERP / add-ons / base / l / ir_http.py

In the _handle_exception method somewhere near line 140 you will find this piece of code:

 attach = self._serve_attachment() if attach: return attach 

Replace it:

 if isinstance(exception, werkzeug.exceptions.HTTPException) and exception.code == 404: attach = self._serve_attachment() if attach: return attach 
0
source

You can perfectly serve all databases with one OpenERP server on your computer. Unfortunately, you did not indicate what mistake you saw and what you expected as a result - it will be a little more difficult for you to help you; -)

Anyway, here are some random ideas based on the information you provided:

  • If you have a problem with OpenERP not listening on all interfaces, try specifying 0.0.0.0 as the xmlrpc_interface file in the configuration file, this should have OpenERP listening on 8069 on all IP addresses.

  • Note that Apache does not matter if you connect to, for example, http://www.sample.com:8069/?db=openerp , because you connect directly to OpenERP. If you want to go through Apache, you need to configure the ReverseProxy rules in your vhost configurations, and OpenERP does not need to listen to all public IP addresses.

  • OpenERP 6.1 and later versions can automatically determine the database name based on the virtual host name and filter the name of available databases: you need to run it with the -db-filter parameter, which is a template used to filter the list of available databases. % h represents the domain name, and% d is the first domain component of this domain. So, for example, with -db-filter = ^% d $ I will see a test database if I end up on the server using http://test.example.com:8069 . If there is only one database, the list is not displayed, and the user will directly get to the desired database. This works even with Apache reverse proxies, if you make sure that OpenERP sees the external host name, i.e. By setting the X-Forwarded-Host header in the Apache proxy configuration and turning on the -proxy OpenERP mode.

    The problem of port reuse occurs because you are trying to run multiple OpenERP servers in the same interface / port combination. It is simply impossible if you do not try to start only one server on an IP with an IP address in the xmlrpc_interface parameter, and I don’t think you need it. Named virtual hosts supported by Apache are handled by one main process that listens on port 80 on all interfaces. If you want to do the same with OpenERP, you only need to run one OpenERP server for all your domains and make it listen on 0.0.0.0, port 8069, as I explained above. In addition, it is not clear what you would install differently in different configuration files. Running 40 different OpenERP servers on the same machine with the same code sounds like a lot of busting. OpenERP is designed for multi-user networks, so many (read: hundreds) of databases can be served from the same server.

0
source

Source: https://habr.com/ru/post/987064/


All Articles