document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. server {
  2.   listen 80 default_server;
  3.   server_name www.tripelover.com;
  4.   root /usr/share/nginx/html;
  5.   index index.html index.htm;
  6.  
  7.   location / {
  8.     #### Backend ====> Proxy ----> User
  9.     # Sanitize Session IDs from <href=""> links in response HTML
  10.     # Note: Compression must be disabled on the backend server,
  11.     #   otherwise this won\'t work
  12.     subs_filter \'sid=([\\w\\d]{32})\' \'\' ir;
  13.    
  14.     # Invalidate cookie if user logs out
  15.     if ($args ~ mode=logout) {
  16.         add_header Set-Cookie \'sessionid=deleted; path=/; domain=.tripelover.com; Expires=Thu, 01-Jan-1970 00:00:01 GMT\';
  17.         # Sanitise \'sid=\' from Location: header sent by the backend
  18.         more_set_headers \'Location: http://www.tripelover.com/\';
  19.     }
  20.  
  21.     # This is where the magic happens
  22.     # The \'sid=\' query parameter from the backend is replaced with a cookie
  23.     if ($args !~ mode=logout) {
  24.         header_filter_by_lua_file /etc/nginx/sid_killer.lua;
  25.     }
  26.  
  27.     #### User ----> Proxy ====> Backend
  28.     # Add \'sid=\' query parameter back from cookie for the backend application server
  29.     if ($args !~ sid) {
  30.         rewrite ^(.*)$ $1?sid=$cookie_sessionid;
  31.     }
  32.  
  33.     # This is where the legacy application is hosted
  34.     proxy_pass http://127.0.0.1:8080;
  35.     proxy_set_header Host $host;
  36.   }
  37. }
');