This question has been flagged
2 Replies
6241 Views

I made a db in my odoo instance that is accessed through xxx.mydomain.com (xxx is a subdomain), recently my customer told me that I need to show his website through his own domain hisdomain.com, I did configure things in my Nginx config file and I created a proxy_pass from hisdomain.com to xxx.mydomain.com, I did this to access to the correct db in odoo through hisdomain.com, I use ^% d$ in my config file, so now I have two ways To acces the xxx Database: hisdomain.com and xxx.mydomain.com, I guess that google going to think that hisdomain.com have duplicate information from xxx.mydomain.com and this will affects SEO.


How can I solve this?

This is my nginx config file:


server {
        listen 80;
        server_name xxx.mydomain.com;
        client_max_body_size 200m;
        proxy_read_timeout 720s;
        proxy_connect_timeout 720s;
        proxy_send_timeout 720s;
        # Add Headers for odoo proxy mode
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        add_header Strict-Transport-Security max-age=15768000;
         # log
        access_log /var/log/nginx/odoo.xxx.access.log;
        error_log /var/log/nginx/odoo.xxx.error.log;
        # Redirect requests to odoo backend server
        location / {
          proxy_redirect off;
          proxy_pass http://odoo;
        }
        location /longpolling {
            proxy_pass http://odoochat;
        }
        location ~* /web/static/ {
             proxy_cache_valid 200 90m;
             proxy_buffering on;
             expires 864000;
            proxy_pass http://odoo;
       }
       # common gzip
       gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
       gzip on;
}
server{
        listen 80;
        server_name www.hisdomain.com;

         add_header Strict-Transport-Security max-age=15768000;
         # log
        access_log /var/log/nginx/odoo.xxx.access.log;
        error_log /var/log/nginx/odoo.xxx.error.log;

        location / {
          proxy_redirect off;
          proxy_pass http://xxx.mydomain.com;
        }
}

server{
        listen 80;
        server_name hisdomain.com;
        # Strict Transport Security
      add_header Strict-Transport-Security max-age=15768000;
         # log
        access_log /var/log/nginx/odoo.xxx.access.log;
        error_log /var/log/nginx/odoo.xxx.error.log;

     # Redirect 301 to HTTPS
     return 301 http://www.$host$request_uri;
}
Avatar
Discard
Best Answer

Why don't you simply proxypass to the server http://xxx.xxx.xxx.xxx:8069 instead of the domain? I do not understand your approach, it is different from everything I have seen as recommended.

If your customer wants to use www.hisdomain.com, you do not have to change the setup with dbfilter, because the dbfilter %d strips out the www. from the domain name, therefore it points to database hisdomain.

You have to backup your database named xxx and restore it with the name hisdomain. Then delete your vhost xxx.mydomain.com in your nginx configuration and your problem is solved.

In my case I use to set up the database hisdomain with hisdomain.mydomain.com using %d dbfilter and when going live with www.hisdomain.com I have nothing else to do than removing the cname record from mydomain.com and pointing hisdomain.com to my server IP.

Avatar
Discard
Author

Thanks for your help Ermin, I did it, but the database and his domain striped both have different names, so the way that I did find to solve it was the proxy setting, but now the same db is filtered by two way and that generates duplicate content for SEO D:.

Apologize for my bad english.

Author

Ermin Thanks, I never evidenced that the %d uses the domain name when the www is present. thanks a lot!!

Well, as documented, %d strips off "www.". So what remains after stripping of?.... :-)

The intention of the developers - and so it is documented - wanted to strip off "www." from www.subdomain.domain.tld in order to get subdomain as the database name. But the code is not asking for a subdomain, it simply strips off www. :-)

Author

Sure, was an idiomatic confusion, sometimes I don't understand what i'm reading in english, so I understood that %d been takes www as database name. :D

Author Best Answer

Ermin, I had to do that because in first instance my customer was working in xxx.mydomain.com (OVER XXX SUBDOMAIN)

but now he want to use his own domain, I have multiple subdomains filtered by ^%d$, and de XXX subdomain filters xxx database, when I use just the domain, the db don't filter directly, so, I made a proxy from hisdomain.com to xxx.mydomain.com and this solved the problem.

Other thing that I forget to mention was: hisdomain.com is pointing as cname to my server's ip.

Avatar
Discard

See my amended answer.

Author

Thanks for your help Ermin, I did it, but the database and his domain striped both have different names, so the way that I did find to solve it was the proxy setting, but now the same db is filtered by two way and that generates duplicate content for SEO D:.

Apologize for my bad english.

You have to backup your database with the name xxx and restore it with the name mydomain and your problem is solved.

Forget my comment before, I can't delete it. See my amended answer.