full of … these

Redirect http to https behind varnish for php services

Posted: July 21st, 2011 | Author: | Filed under: howto | Tags: , , | 1 Comment »

It may happen to want to redirect a site from http to https behind a varnish cache system.

Is known the fact that varnish has a lack of redirect procedures, mostly from http to https.

A redirect on varnish from http to https looks like this:

if (req.http.host ~ "^(www\.)?site\.com$" && req.url ~ "\/checkout\/cart") {
       error 750 "https://www.site.com/checkout/cart";
sub vcl_error {
 #redirect to https
 if (obj.status == 750) {
 set obj.http.Location = obj.response;
 set obj.status = 302;
 return(deliver);
 }
 }

That will not work!

Varnish is not aware if the request was made from http (request directly sent to varnish) or https (request sent to pound).

So, I have found another page suggesting that the redirect can be added to php like this:

if (($_SERVER['REQUEST_URI'] == '/admin' || $_SERVER['REQUEST_URI'] ==  '/checkout/cart/') && !$_SERVER['HTTP_X_FORWARDED_PROTO']){
  header("Location: https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
}elseif (($_SERVER['REQUEST_URI'] != '/admin' && $_SERVER['REQUEST_URI'] != '/checkout/cart/') && $_SERVER['HTTP_X_FORWARDED_PROTO']) {
  header("Location: http://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
}

This code fixes https redirection.
Any comments are welcome. I am new to varnish.


Blue Iris Error: 8000274d (OnConnect: 10061), block 0.

Posted: June 15th, 2011 | Author: | Filed under: idiots | Tags: | No Comments »

If you upgraded recently, automatically or not, and you can’t see anything in cameras added to Blue Iris you might have connectivity issues.

To debug this, telnet to the ip and port you have using in the camera settings.

If telnet is not working stop the firewall to be sure you are not  limited by it.  And try again in blue iris.

If still no luck, open tcpview, reset camera and quickly check the ports blue iris is accessing.

Compare the port actually used to the one you have setup on the camera. You may find that after the upgrade the ports were changed in blue iris.

I have found that my video port was replaced with default video port (port 554) and web port was changed to my custom video port.


Rotate backups over FTP

Posted: June 14th, 2011 | Author: | Filed under: howto | Tags: , | No Comments »

I was looking for a method to rotate old files from external backup account.

It looks like is not that easy but a small fuse module can mount the ftp account locally. This allows you to use scripts and tools from local server to search, delele, upload, download files like they were local.

To carry out this I have installed curlftpfs:
apt-get install curlftpfs

Mount the external ftp account:
curlftpfs -o allow_other username:p4ss@backupserver.external /media/ftpmount/

Notice the -o allow_other, without this no other user than the user used to mount the account will be able to use it.

Now you can use: rsync, find, cp, vim or du to make whatever you need with the files.


Toshiba Tecra A8-PTA83E – Enable sound on Windows 7

Posted: May 25th, 2011 | Author: | Filed under: idiots | Tags: , , , , | No Comments »

After upgrading from Windows Vista or from Windows XP you will find out that the sound doesn’t work.

Like me, you have tried all the drivers available on the internet: XP sound drivers, Vista 32bit or Vista 64bit sound drivers. Still, no luck.

On a forum, I have found a post about a tool that enables the sound for Vista.

The name, obviously, is “Sound Utility to Turn Mute Off”.

The link to the tool:

http://www.csd.toshiba.com/cgi-bin/tais/support/jsp/downloadDetail.jsp?soid=1671893&pf=true

Let me know if this helped you, it did worked for me in Windows 7 x64.

 

EDIT: The step was required only when I have first time installed Windows 7. Second time I have installed Windows 7, the sound was working from the first boot.


IPv6 ready

Posted: February 4th, 2011 | Author: | Filed under: online | Tags: , | No Comments »

Starting today I have added an IPv6 to my domain:
Name: systemadmin.ro
Addresses: 2607:f298:2:121::4fd:e97d

So, I’m ready for IPv6 visits.