We continue the topic, how affiliate networks can protect the contacts of its direct adverts. In this article I will tell you how to technically implement the described methods. It’s about masking the domain of the site. Of course, you can use these methods not only to protect the contacts of the advertiser, but also for other purposes. It all depends on your imagination.
I warn you right away, the material will be understandable only to those who understand the technical part. I will try to chew on the general direction in a scientifically popular way, but for implementation you need to throw a link to the article to your techie.
Mathod 1. AlterCPA White
AlterCPA White is a free and open source miniature proxy from AlterCPA. See in our GitLab for details.
Pros: simple hosting can be used, simple customization is done by replacing a couple of lines.
Cons: not the most stable proxy, may fail on some sites.
Usage algorithm:
- Start any hosting with PHP support, link the purchased domain to it.
- The
.htaccess
andindex.php
files are dragged from the repository and uploaded to the server. - If the server is Nginx, settings are here.
- In the
index.php
file,#
is removed beforeWHITEDOMAIN
, the domain of the target site (which we are replacing) fits there like this:define ( 'WHITEDOMAIN', 'mydomain.com' ).
- If the target site is HTTPS only, remove
#
beforeWHITEHTTPS
. - Next, you need to save the file
index.php
. - We go to our domain and see the desired someone else’s site.
Method 2. Parking to smartlink
We use the same AlterCPA White, only in Smartlink mode – I already talked about it in this article. The algorithm is similar, but instead of a domain, you can use a link with a tail in the SMARTLINK
parameter. For example, a full autologin link. This method has more functionality due to the ability to specify the full link, and not just the domain.
Pros: setup with a couple of files, you can use a link with a tail, for example, a ready-made autologin.
Cons: unstable connection, in case of problems with cookies, the entire session is reset and data may be lost.
Method 3. Setting up server with Nginx
This method is the most correct option. Implemented not through AlterCPA White, this is fully server solution. The result is fast proxying on a reliable web server.
Pros: excellent fast proxying, reliable and proven web server for years.
Cons: need separate server, need knowledge of configuring Nginx.
Site configurations are located in the depths of the Linux server along the path /etc/nginx/sites-enabled
. The target.domain.com
is replaced by the domain of the source site. In your site configuration, instead of the existing location /
, you need to insert:
location / { proxy_pass http://target.domain.com; proxy_set_header Host target.domain.com; proxy_buffering on; proxy_redirect http://target.domain.com $scheme://$host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Proto $scheme; }
If you want to use caching:
- Cache folder is created, for example,
/var/www/cache
. - Next, you need to give the folder to the Nginx user:
chown nginx:nginx /var/www/cache
. - In the file
/etc/nginx/nginx.conf
in the http block is added:
proxy_cache_path /var/www/cache levels=1:2 keys_zone=STATIC:10m inactive=24h max_size=1g
. - In the site configuration file, before
location /
, add:
location ~* .(js|css|png|jpg|jpeg|gif|ico|woff|svg)$ { proxy_cache STATIC; proxy_cache_valid 200 1d; proxy_cache_methods GET; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; proxy_pass http://target.domain.com; proxy_set_header Host target.domain.com; proxy_buffering on; proxy_redirect http://target.domain.com $scheme://$host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Proto $scheme; }
As a result, proxying is carried out through Nginx, and this is the most stable option. But difficult to implement.
Method 4. Private Flare
You can take all the advantages of all the methods above and combine them in one service. We are doing something similar with our crew in Private Flare.
Pros: great proxy, supports caching and compression, visual customization.
Cons: costs money, is by invitation only, requires a separate server.
Setup process:
- Contact the guys at AlterCPA and request access.
- Get yourself a Centos 8 server and login as root.
- In the PrivateFlare control panel, go to Nodes and click on the green plus sign.
- The installation line will appear, execute it on the server.
- Go to the Domains section, click the plus sign there.
- In the Backend IP field, enter the IP address of your target site.
- Specify its domain in the Mask as field.
- In the Domains field, enter the domain or list of domains you want to use.
- Click Add.
- In the DNS settings of your domains, specify the A-record for them with the server address from step 2.
- Within a few minutes after DNS activation, all domains will become available and show the target sites.
Conclusion
Masking the domain of the target site can come in handy in different cases. For example, when you need to hide direct advertising contacts. There are several ways to do this, I told you about them.