I am using Heroku pipes. So when I push my application it is pushed to staging app
https://appname.herokuapp.com/
and if everything is correct I promote that app to prodcution. There is no new build process. It is the same app that was build the first time for staging.
https://appname.com/
The thing is that this causes a problem with duplicate content. Sites are clones of each other. Exactly the same. I would like to exclude the staging app from Google indexing and search engine.
One way that I thought off was with robots.txt file.
For this to work I should write it like this
User-agent: *
Disallow: https://appname.herokuapp.com/
using the absolute path because this file will be on the server in staging and production application and I only wanna remove staging app from Google indexing and not touch the production one.
Is this the right way to do it?