Wednesday, August 27, 2014

Using Cookie as RewriteRule variable in Apache ReverseProxy



If have a cookie named myServerName, and want to check for its availability and use its content for building a URL

Code:
RewriteCond %{REQUEST_URI} ^/
RewriteCond %{HTTP_COOKIE} ^.*myServerName=([^;]+)
RewriteRule /(.*) http://%1.test.com.au/$1 [P]


Re Write to get the content from AWS S3 Bucket RewriteEngine On RewriteCond %{HTTP_COOKIE} ^.*mycookie.*$ [NC] RequestHeader set Host 's3-ap-southeast-2.amazonaws.com' RewriteRule (.*)/files/(.*) http://s3-ap-southeast-2.amazonaws.com/mybucket/$2 [P] ProxyPassReverse /files/ http://s3-ap-southeast-2.amazonaws.com/mybucket/ #If no Cookies Found RewriteRule (.*)/files/(.*) http://s3-ap-southeast-2.amazonaws.com/mybucket//error_url/error.html [P] ProxyPassReverse /files/ http://s3-ap-southeast-2.amazonaws.com/mybucket/

Monday, August 4, 2014

Easy Table Sorting and Searching with JQuery Plugings



<link rel="stylesheet" href="........../themes/blue/style.css" />

<script type="text/javascript" src="...../jquery.tablesorter.min.js"></script>
<script type="text/javascript" src=".../jquery.searcher.min.js"></script>


            <input id="tablesearchinput" />
            <table id="student-list" class="tablesorter">
                <thead>
                    <tr>
                        <th class="id">Student Id</th>
                        <th class="name">Student Name</th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
            </table>

$("#student-list").tablesorter();
$("#student-list").searcher({
inputSelector: "#tablesearchinput"
});