Nov 30, 2017

Testing out a new way to monetize using Coinhive!

Ever since Google implemented their Panda angorithm years ago, and ever since Google booted me off Adsense for no reason whatsoever, I've been struggling to monetize Bauer-Power. To add insult to injury, Ad Blockers have become ever so popular as well, which kills monetization even more.

Look, I get it. Ads are annoying, however they are what keeps many websites free and their content free. It's a lot like terrestrial television. I digress...

Anyway, I discovered an interesting way to possibly monetize Bauer-Power recently. And it doesn't cost you a dime! At the top of the page, you should see a Coinhive banner like this:


Loading...


When you click on it, a simple javascript kicks off that borrows some of your CPU power to mine Monero cryptocurrency for me. When you press the pause button, or leave the site, the miner stops. Simple! While you are reading my content, you can throw me a bone by letting me borrow some CPU. No big deal right?

If you click on the links in this post, you may also notice that they take you to a Coinhive redirect page first. That also mines a little Monero for me to help out as well.

Hopefully this method works, because to be honest, I have yet to find a truly viable alternative to Google Adsense. On top of that, if I made more money on Bauer-Power, I would be able to add content more frequently.

Nov 9, 2017

How to log X-Forwarded-For events in IIS 8.5+ and in Apache

At my day job, we use a cloud based content delivery service called Incapsula that also acts as a cloud based load balancer. Like just about every load balancing solution, when traffic finally hits your web server, the only IP addresses you see are usually that of the load balancer. The same holds true with Incapsula.

Well, the other day I was asked to identify certain traffic by IP address, and I couldn't. The logs only showed that of Incapsula. I asked Incapsula for their logs so I could correlate, but they only keep security related logs due to PCI compliance, which is understandable. That meant that I needed a way to log X-Forwarded-For header information going forward.

If you are not familiar with X-Forwarded-For, according to Wikipedia:
The X-Forwarded-For (XFF) HTTP header field is a common method for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or load balancer.
Makes sense right? Well, the good news is that both Apache and IIS (8.5 and above) support logging X-Forwarded-For natively with some slight modifications.

For IIS:
  • In IIS Manager, click the server name in the left panel to go to the Home screen
  • Click on Logging
  • Click on the Select Fields button
  • Click on the Add Field button
  • In the Field Name box enter x-forwarded-for
  • Leave Source Type set to Request Header
  • In the Source box enter X-Forwarded-For
  • Click OK
  • Click OK again
  • In the upper right of the Logging page click Apply
  • Restart IIS
Your logs will now be appended with _x to show that the logs contain custom fields. You can also follow this same process at the site level if you want. The above example makes the change global for all sites on the server.

For Apache (In Ubuntu):
  • Edit /etc/apache2/apache2.conf
  • Find the line that says
    LogFormat “%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  • Change it to
    LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  • Restart Apache

Simple right? Now you will be able to see actual client IP's in your logs!

Did this post help you? Let us know in the comments!



Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | stopping spam