Skip to Content
Menu
This question has been flagged
8 Replies
10642 Views

Hello there !

First of all, I'm kind of new to virtual hosts and redirecting urls.

I am trying to setup apache to redirect a subdomain to a matching openerp database on my server. Example: http://foo.mydomain.com will call the database foo.

I'm testing with localhost, so I edited /etc/hosts with something like this:

127.0.0.1 foo.localhost
127.0.0.1 bar.localhost
    

Here is my virtual host declaration in /etc/apache2/sites-available/openerp.conf:

<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, I wrote dbfilter = ^%d$ in my openerp.conf file. After apache2 and openerp were restarted, I started testing it.

The thing is, the first time I try to reach a new database, I have to explicitely write http://database-name.localhost?db=name-of-the-new-db. After the first login/logout, I just have to type http://database-name.localhost, as expected. I'm not sure if I have to do it on all computers (no tested yet) but it's kinda weird I think.

Is it part of openrp mechanism to bound a subdomain to a database, or just a bug, or something I've done wrong ?

Thanks

(my edit was a clarification one)

No one ?

Avatar
Discard
Best Answer

Check this for your answer https://www.odoo.com/forum/help-1/question/how-to-set-database-filter-on-sub-domain-for-odoo-website-using-apache-web-server-64935#answer-65100

Avatar
Discard
Author

Thanks, I'll have a look at this !

Author

This is exactly what I have in my config files... But I still have to write subdomain.localhost/?db=subdomain the first time for each new database. The second time and later, I just need subdomain.localhost, and it will write the ?db= part itself.

Best Answer

Here is a complete write up of how we implement Apache to redirect urls to databases.

www.inlinetechnology.com/blog/howto-4/post/odoo-mapping-url-to-database-36

Avatar
Discard
Best Answer

maybe you can use port redirect in apache vhost instead of using your method

becoz i use port redirect for my case

maybe you can try my conf

<VirtualHost *:80>

ServerName mydomain.com

Redirect 8069 / http://mydomain.com:8069/

</VirtualHost>

Avatar
Discard
Author

This is exactly what I'm doing, I think. But perhaps you can share your conf files ? :)

servername a.b.com redeirect / http://a.b.com:8069
Author

I tried this way, but it's very tedious, as you'll have to create one virtual host entry for each subdomain.

Related Posts Replies Views Activity
0
May 23
1820
2
May 24
4771
2
Jun 23
20080
1
Aug 19
3122
0
Sep 15
5239