Monday 12 November 2012

Grails weird size error message property convention

Alright, what I noticed about the grails domain validation errors, is that defined convention which suggests that; lets say

class MyDomain {
String field
    def constraint = {
    field size: 5..10
    }
}


normally, according to the grails convention property definition in the messages.properties file should be something like

mydomain.field.size=Field size must be 5 to 10 characters.


But instead the generated error code for the field is;

mydomain.field.size.error=Field size must be 5 to 10 characters.

I feel bothered about it because to understand that I have to check the error codes array. And what I notice that; grails (or spring I don't know I am a bit new to the spring framework and validation is part of the spring framework) generates about 20 different arbitrary error codes for the same error of the field? What is the logic behind it?

Friday 30 March 2012

Example reverse cache proxy configurations for: nginx, apache httpd, apache traffic server and varnish

First time run of these servers can be tough for these proxy servers that I learned from my experiences therefore I would like to share very brief example configurations for there 4 different proxy technologies,

nginx
configuration file of nginx is nginx.conf needs to be configured to set the nginx to act as a caching proxy server. Cache definition requires a caching file location definition (cache_path) therefore without creating and having permission to write this file it will not work properly.
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
 worker_connections 768;
 # multi_accept on;
}

http {

 ##
 # Basic Settings
 ##

 sendfile on;
 tcp_nopush on;
 tcp_nodelay on;
 keepalive_timeout 65;
 types_hash_max_size 2048;

 proxy_cache_path  /var/www/cache levels=1:2 keys_zone=ali:8m max_size=1000m inactive=600m; #cache file
 proxy_temp_path /var/www/cache/tmp; 
 # server_tokens off;

server {
  listen          3344;
  location / {
 proxy_pass http://localhost:9015;
 proxy_cache_valid  200 10s; #ttl value for cache
 proxy_cache ali; # cach_path definition name
 
  }
  
 }

 # server_names_hash_bucket_size 64;
 # server_name_in_redirect off;
 ##
 # Logging Settings
 ##

 access_log /var/log/nginx/access.log;
 error_log /var/log/nginx/error.log;


}

#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# 
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
# 
# server {
#  listen     localhost:110;
#  protocol   pop3;
#  proxy      on;
# }
# 
# server {
#  listen     localhost:143;
#  protocol   imap;
#  proxy      on;
# }
#}

apache httpd
Tricky bit of this product was permission to write to the disk cache file. Again after the file write permission (chmod 777) the problem solved). The example below contains extra modules enabled that I was making experiments on it but the required field and modules are below.

The modules should be activated to use apache server as a reverse proxy;
cache_module modules/mod_cache.so
cache_disk_module modules/mod_cache_disk.so

#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See  for detailed information.
# In particular, see 
# 
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so 'log/access_log'
# with ServerRoot set to '/www' will be interpreted by the
# server as '/www/log/access_log', where as '/log/access_log' will be
# interpreted as '/log/access_log'.

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used.  If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "/usr/local/apache2"

#
# Mutex: Allows you to set the mutex mechanism and mutex file directory
# for individual mutexes, or change the global defaults
#
# Uncomment and change the directory if mutexes are file-based and the default
# mutex file directory is not on a local disk or is not appropriate for some
# other reason.
#
# Mutex default:logs

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the 
# directive.
#
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses.
#
Listen 9999 # required port that httpd starts to listen for the requests
#Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_socache_module modules/mod_authn_socache.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_form_module modules/mod_auth_form.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule allowmethods_module modules/mod_allowmethods.so
#LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule cache_disk_module modules/mod_cache_disk.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule socache_dbm_module modules/mod_socache_dbm.so
#LoadModule socache_memcache_module modules/mod_socache_memcache.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule dumpio_module modules/mod_dumpio.so
#LoadModule buffer_module modules/mod_buffer.so
#LoadModule ratelimit_module modules/mod_ratelimit.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule request_module modules/mod_request.so
#LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule sed_module modules/mod_sed.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_debug_module modules/mod_log_debug.so
#LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
#LoadModule remoteip_module modules/mod_remoteip.so
LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_express_module modules/mod_proxy_express.so
#LoadModule session_module modules/mod_session.so
#LoadModule session_cookie_module modules/mod_session_cookie.so
#LoadModule session_dbd_module modules/mod_session_dbd.so
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
#LoadModule ssl_module modules/mod_ssl.so
#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
LoadModule unixd_module modules/mod_unixd.so
#LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule info_module modules/mod_info.so
#LoadModule cgid_module modules/mod_cgid.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
#LoadModule actions_module modules/mod_actions.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so


#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon


# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
#  definition.  These values also provide defaults for
# any  containers you may define later in the file.
#
# All of these directives may appear inside  containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin you@example.com

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
#  blocks below.
#

    AllowOverride none
    Require all denied

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/usr/local/apache2/htdocs"

    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/trunk/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Require all granted

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#

    DirectoryIndex index.html

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#

    Require all denied

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a 
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a 
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn


    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%{cache-status}e %h %l %u %t \"%r\" %>s %b" common

    
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a 
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per- access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog "logs/access_log" common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog "logs/access_log" combined


    #
    # Redirect: Allows you to tell clients about documents that used to 
    # exist in your server's namespace, but do not anymore. The client 
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a  section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts. 
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"



    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock logs/cgisock

#
# "/usr/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#

    AllowOverride None
    Options None
    Require all granted


    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values 'default', 'none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#MaxRanges unlimited

#
# EnableMMAP and EnableSendfile: On systems that support it, 
# memory-mapping or the sendfile syscall may be used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted 
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults: EnableMMAP On, EnableSendfile Off
#
#EnableMMAP off
#EnableSendfile on

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be 
# included to add extra features or to modify the default configuration of 
# the server, or you may simply copy their contents here and change as 
# necessary.

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

# Language settings
#Include conf/extra/httpd-languages.conf

# User home directories
#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

# Various default settings
#Include conf/extra/httpd-default.conf

# Configure mod_proxy_html to understand HTML4/XHTML1

Include conf/extra/proxy-html.conf

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#

SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
ProxyPass / http://127.0.0.1:9015/ #required
CacheEnable disk / # required
CacheHeader on
CacheRoot /usr/cache # required , do chmod 777 or give ownership to the daemon user
CacheDirLevels 4
CacheDirLength 4
CacheIgnoreNoLastMod On # not required but to cache every request enable this
CacheDefaultExpire 10
CacheDetailHeader on
CacheIgnoreCacheControl On # not required but to cache every request enable thisCacheLock on
CacheMaxExpire 20
CacheLockMaxAge 5

varnish
it is very easy to configure the varnish for getting started with varnish. You just map the backend server like below. You don't define a listening port in varnish configuration file for the varnish, you pass this value in the command line to start up the varnish.

# This is a basic VCL configuration file for varnish.  See the vcl(7)
# man page for details on VCL syntax and semantics.
# 
# Default backend definition.  Set this to point to your content
# server.
# 

import std;

backend default {
    .host = "127.0.0.1";
    .port = "9015";
}

sub vcl_fetch {  
  set beresp.ttl=20s; # ttl for cached data
  return (deliver);
}

# 
# Below is a commented-out copy of the default VCL logic.  If you
# redefine any of these subroutines, the built-in logic will be
# appended to your code.
# 
# sub vcl_recv {
#     if (req.restarts == 0) {
#  if (req.http.x-forwarded-for) {
#      set req.http.X-Forwarded-For =
#   req.http.X-Forwarded-For ", " client.ip;
#  } else {
#      set req.http.X-Forwarded-For = client.ip;
#  }
#     }
#     if (req.request != "GET" &&
#       req.request != "HEAD" &&
#       req.request != "PUT" &&
#       req.request != "POST" &&
#       req.request != "TRACE" &&
#       req.request != "OPTIONS" &&
#       req.request != "DELETE") {
#         /* Non-RFC2616 or CONNECT which is weird. */
#         return (pipe);
#     }
#     if (req.request != "GET" && req.request != "HEAD") {
#         /* We only deal with GET and HEAD by default */
#         return (pass);
#     }
#     if (req.http.Authorization || req.http.Cookie) {
#         /* Not cacheable by default */
#         return (pass);
#     }
#     return (lookup);
# }
# 
# sub vcl_pipe {
#     # Note that only the first request to the backend will have
#     # X-Forwarded-For set.  If you use X-Forwarded-For and want to
#     # have it set for all requests, make sure to have:
#     # set bereq.http.connection = "close";
#     # here.  It is not set by default as it might break some broken web
#     # applications, like IIS with NTLM authentication.
#     return (pipe);
# }
# 
# sub vcl_pass {
#     return (pass);
# }
# 
# sub vcl_hash {
#     set req.hash += req.url;
#     if (req.http.host) {
#         set req.hash += req.http.host;
#     } else {
#         set req.hash += server.ip;
#     }
#     return (hash);
# }
# 
# sub vcl_hit {
#     if (!obj.cacheable) {
#         return (pass);
#     }
#     return (deliver);
# }
# 
# sub vcl_miss {
#     return (fetch);
# }
# 
# sub vcl_fetch {
#     if (!beresp.cacheable) {
#         return (pass);
#     }
#     if (beresp.http.Set-Cookie) {
#         return (pass);
#     }
#     return (deliver);
# }
# 
# sub vcl_deliver {
#     return (deliver);
# }
# 
# sub vcl_error {
#     set obj.http.Content-Type = "text/html; charset=utf-8";
#     synthetic {"
# 
# #  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
# 
#   

#     Varnish cache server
#   
# 
# "};
#     return (deliver);
# }

apache traffic server

This one was the toughest one to start up at the first time. This product has 3 different configuration file to set up the proxy;

1. cache.config

you should add the line below to define the destination which the request comes to this will be cached and ttl for the cached data

dest_ip=127.0.0.1 scheme=http ttl-in-cache=5s

2. records.conf

should be set like below

#
#
# Process Records Config File
#
#    
#
# RECORD-TYPE: CONFIG, LOCAL
# NAME:  name of variable
# TYPE:  INT, STRING, FLOAT
# VALUE:  Initial value for record
#
#
# *NOTE*: All options covered in this file should be documented in the
#         administration guide or the addendum:
#
#
##############################################################################
#
# System Variables
#
##############################################################################
CONFIG proxy.config.proxy_name STRING grass
CONFIG proxy.config.config_dir STRING etc/trafficserver
CONFIG proxy.config.proxy_binary_opts STRING -M
CONFIG proxy.config.env_prep STRING example_prep.sh
CONFIG proxy.config.temp_dir STRING /tmp
CONFIG proxy.config.alarm_email STRING nobody
CONFIG proxy.config.syslog_facility STRING LOG_DAEMON
CONFIG proxy.config.output.logfile STRING traffic.out
CONFIG proxy.config.snapshot_dir STRING snapshots
CONFIG proxy.config.system.mmap_max INT 2097152
##############################################################################
#
# Main threads configuration (worker threads). Also see configurations for
# SSL threads, disk I/O threads and task threads in their respective areas.
#
##############################################################################
CONFIG proxy.config.exec_thread.autoconfig INT 1
CONFIG proxy.config.exec_thread.autoconfig.scale FLOAT 1.500000
CONFIG proxy.config.exec_thread.limit INT 2
CONFIG proxy.config.accept_threads INT 1
##############################################################################
#
# Local Manager
#
##############################################################################
CONFIG proxy.config.admin.admin_user STRING admin
CONFIG proxy.config.admin.number_config_bak INT 3
CONFIG proxy.config.admin.user_id STRING nobody
##############################################################################
#
# Process Manager
#
##############################################################################
CONFIG proxy.config.admin.autoconf_port INT 8083
CONFIG proxy.config.process_manager.mgmt_port INT 8084
##############################################################################
#
# In order to only bind a specific IP, use the following config, as in 
# the example below. Note
#
##############################################################################
#LOCAL proxy.local.incoming_ip_to_bind STRING 192.168.101.17
##############################################################################
#
# Alarm Configuration
#
##############################################################################
   # execute alarm as "/ """
CONFIG proxy.config.alarm.bin STRING example_alarm_bin.sh
CONFIG proxy.config.alarm.abs_path STRING NULL
##############################################################################
#
# HTTP Engine
#
##############################################################################
   ##########
   # basics #
   ##########
   # The main server_port is listed here, other server ports is a
   # string of ports, separated by whitespace.  The port attributes
   # should be set to X(default behavior). For example...
   # server_other_ports STRING 1234:X 12345:X
CONFIG proxy.config.http.server_port INT 1212
CONFIG proxy.config.http.server_port_attr STRING X
# to enable IPv6 listening on port 8080:
# CONFIG proxy.config.http.server_other_ports STRING 8080:X6
CONFIG proxy.config.http.server_other_ports STRING NULL
CONFIG proxy.config.http.connect_ports STRING 443 563
CONFIG proxy.config.http.insert_request_via_str INT 1
CONFIG proxy.config.http.insert_response_via_str INT 0
CONFIG proxy.config.http.verbose_via_str INT 2
CONFIG proxy.config.http.response_server_enabled INT 1
CONFIG proxy.config.http.enable_url_expandomatic INT 0
CONFIG proxy.config.http.no_dns_just_forward_to_parent INT 0
CONFIG proxy.config.http.uncacheable_requests_bypass_parent INT 1
CONFIG proxy.config.http.keep_alive_enabled_in INT 1
CONFIG proxy.config.http.keep_alive_enabled_out INT 1
CONFIG proxy.config.http.chunking_enabled INT 1
   # send http11 requests:
   #   0 - Never
   #   1 - Always
   #   2 - if the server has returned http1.1 before
   #   3 - if the client request is 1.1 & the server
   #         has returned 1.1 before
CONFIG proxy.config.http.send_http11_requests INT 1
CONFIG proxy.config.http.share_server_sessions INT 1
CONFIG proxy.config.http.origin_server_pipeline INT 1
CONFIG proxy.config.http.user_agent_pipeline INT 8
   ##########################
   # HTTP referer filtering #
   ##########################
CONFIG proxy.config.http.referer_filter INT 0
CONFIG proxy.config.http.referer_format_redirect INT 0
CONFIG proxy.config.http.referer_default_redirect STRING http://www.example.com/
   ##############################
   # parent proxy configuration #
   ##############################
CONFIG proxy.config.http.parent_proxy_routing_enable INT 0
CONFIG proxy.config.http.parent_proxy.retry_time INT 300
   # Parent fail threshold is the number of request that must
   # fail within the retry window for the parent to be marked
   # down
CONFIG proxy.config.http.parent_proxy.fail_threshold INT 10
CONFIG proxy.config.http.parent_proxy.total_connect_attempts INT 4
CONFIG proxy.config.http.parent_proxy.per_parent_connect_attempts INT 2
CONFIG proxy.config.http.parent_proxy.connect_attempts_timeout INT 30
CONFIG proxy.config.http.forward.proxy_auth_to_parent INT 0
   ###################################
   # HTTP connection timeouts (secs) #
   ###################################
   # out: proxy -> origin server connection
   # in : ua -> proxy connection
CONFIG proxy.config.http.keep_alive_no_activity_timeout_in INT 115
CONFIG proxy.config.http.keep_alive_no_activity_timeout_out INT 120
CONFIG proxy.config.http.transaction_no_activity_timeout_in INT 30
CONFIG proxy.config.http.transaction_no_activity_timeout_out INT 30
CONFIG proxy.config.http.transaction_active_timeout_in INT 900
CONFIG proxy.config.http.transaction_active_timeout_out INT 0
CONFIG proxy.config.http.accept_no_activity_timeout INT 120
CONFIG proxy.config.http.background_fill_active_timeout INT 60
CONFIG proxy.config.http.background_fill_completed_threshold FLOAT 0.500000
   ##################################
   # origin server connect attempts #
   ##################################
CONFIG proxy.config.http.connect_attempts_max_retries INT 6
CONFIG proxy.config.http.connect_attempts_max_retries_dead_server INT 3
CONFIG proxy.config.http.connect_attempts_rr_retries INT 3
CONFIG proxy.config.http.connect_attempts_timeout INT 30
CONFIG proxy.config.http.post_connect_attempts_timeout INT 1800
CONFIG proxy.config.http.down_server.cache_time INT 10
CONFIG proxy.config.http.down_server.abort_threshold INT 10
   ##################################
   # congestion control             #
   ##################################
CONFIG proxy.config.http.congestion_control.enabled INT 0
   #############################
   # negative response caching #
   #############################
CONFIG proxy.config.http.negative_caching_enabled INT 0
CONFIG proxy.config.http.negative_caching_lifetime INT 1800
   #########################
   # proxy users variables #
   #########################
CONFIG proxy.config.http.anonymize_remove_from INT 0
CONFIG proxy.config.http.anonymize_remove_referer INT 0
CONFIG proxy.config.http.anonymize_remove_user_agent INT 0
CONFIG proxy.config.http.anonymize_remove_cookie INT 0
CONFIG proxy.config.http.anonymize_remove_client_ip INT 0
CONFIG proxy.config.http.anonymize_insert_client_ip INT 1
CONFIG proxy.config.http.anonymize_other_header_list STRING NULL
CONFIG proxy.config.http.append_xforwards_header INT 0
CONFIG proxy.config.http.insert_squid_x_forwarded_for INT 1
   ############
   # security #
   ############
CONFIG proxy.config.http.push_method_enabled INT 0
#  ###################################
#  # HTTP Quick filtering (security) #
#  ###################################
#  This is dedicated and very specific 'HTTP method' filter.
#  Note: If method does not match, filtering will be skipped.
#  bits 15-0 - HTTP method mask
#       0x0000 - Any possible HTTP method (or you can use 0xFFFF)
#       0x0001 - CONNECT
#       0x0002 - DELETE
#       0x0004 - GET
#       0x0008 - HEAD
#       0x0010 - ICP_QUERY
#       0x0020 - OPTIONS
#       0x0040 - POST
#       0x0080 - PURGE
#       0x0100 - PUT
#       0x0200 - TRACE
#       0x0400 - PUSH
#  bits 18-16 - IP address type
#       reserved
#  bits 30-19 - reserved
#  bit 31 - Action (allow=1, deny=0), leave at zero
#  Note: if 'proxy.config.http.quick_filter.mask' is equal 0, there is no 'quick http filtering' at all
#
# The default (0x482 or 1154) denies all PUSH, PURGE and DELETE requests (except from 127.0.0.1)
CONFIG proxy.config.http.quick_filter.mask INT 1154
   #################
   # cache control #
   #################
CONFIG proxy.config.http.cache.ignore_accept_mismatch 1
CONFIG proxy.config.http.cache.http INT 1
CONFIG proxy.config.http.cache.ignore_client_no_cache INT 1
CONFIG proxy.config.http.cache.ims_on_client_no_cache INT 1
CONFIG proxy.config.http.cache.ignore_server_no_cache INT 1
CONFIG proxy.config.http.cache.ignore_client_cc_max_age INT 0
CONFIG proxy.config.http.normalize_ae_gzip INT 0
   # cache responses to cookies has 5 options:
   #   0 - do not cache any responses to cookies
   #   1 - cache for any content-type
   #   2 - cache only for image types
   #   3 - cache for all but text content-types
   #   4 - cache for all but text content-types except OS response
   #       without "Set-Cookie" or with "Cache-Control: public"
CONFIG proxy.config.http.cache.cache_responses_to_cookies INT 1
CONFIG proxy.config.http.cache.ignore_authentication INT 0
CONFIG proxy.config.http.cache.cache_urls_that_look_dynamic INT 1
CONFIG proxy.config.http.cache.enable_default_vary_headers INT 0
   #  when_to_revalidate has 5 options:
   #    0 - default. use use cache directives or heuristic
   #    1 - stale if heuristic
   #    2 - always stale (always revalidate)
   #    3 - never stale
   #    4 - always revalidate if request is conditional, else default is used
CONFIG proxy.config.http.cache.when_to_revalidate INT 4
   # Some old MSIE browsers don't send no-cache headers to
   # reverse proxies or transparent caches, this variable controls
   # when to add no-cache headers to MSIE requests:
   #  -1 - no-cache is never added, stats are not updated
   #   0 - default; no-cache not added to MSIE requests
   #   1 - no-cache added to IMS MSIE requests
   #   2 - no-cache added to all MSIE requests
CONFIG proxy.config.http.cache.when_to_add_no_cache_to_msie_requests INT -1
   # required headers: three options:
   #   0 - No required headers to make document cachable
   #   1 - "Last-Modified:", "Expires:", or "Cache-Control: max-age" required
   #   2 - explicit lifetime required, "Expires:" or "Cache-Control: max-age"
CONFIG proxy.config.http.cache.required_headers INT 0
CONFIG proxy.config.http.cache.max_stale_age INT 100000
CONFIG proxy.config.http.cache.range.lookup INT 1
   ########################
   # heuristic expiration #
   ########################
CONFIG proxy.config.http.cache.heuristic_min_lifetime INT 10
CONFIG proxy.config.http.cache.heuristic_max_lifetime INT 20
CONFIG proxy.config.http.cache.heuristic_lm_factor FLOAT 0.100000
CONFIG proxy.config.http.cache.fuzz.time INT 240
CONFIG proxy.config.http.cache.fuzz.probability FLOAT 0.005000
   #########################################
   # dynamic content & content negotiation #
   #########################################
CONFIG proxy.config.http.cache.vary_default_text STRING NULL
CONFIG proxy.config.http.cache.vary_default_images STRING NULL
CONFIG proxy.config.http.cache.vary_default_other STRING NULL
   ##############################################################
   # The HTTP stats are expensive, turn off you don't need them #
   ##############################################################
CONFIG proxy.config.http.enable_http_stats INT 1
##############################################################################
#
# Customizable User Response Pages
#
##############################################################################
   # 0 - turn off customizable user response pages
   # 1 - enable customizable user response pages in only the "default" directory
   # 2 - enable language-targeted user response pages
CONFIG proxy.config.body_factory.enable_customizations INT 0
CONFIG proxy.config.body_factory.enable_logging INT 0
   # 0 - never suppress generated responses
   # 1 - always suppress generated responses
   # 2 - suppress responses for intercepted traffic
CONFIG proxy.config.body_factory.response_suppression_mode INT 0
##############################################################################
#
# Net Subsystem
#
##############################################################################
CONFIG proxy.config.net.connections_throttle INT 30000
   # Enable defer accept / accept filtering. On Linux, this is a timeout, sec.
CONFIG proxy.config.net.defer_accept INT 45
##############################################################################
#
# Cluster Subsystem
#
##############################################################################
   # cluster type requires restart to change
   # 1 is full clustering, 2 is mgmt only, 3 is no clustering
LOCAL proxy.local.cluster.type INT 3
CONFIG proxy.config.cluster.cluster_port INT 8086
CONFIG proxy.config.cluster.rsport INT 8088
CONFIG proxy.config.cluster.mcport INT 8089
CONFIG proxy.config.cluster.mc_group_addr STRING 224.0.1.37
CONFIG proxy.config.cluster.mc_ttl INT 1
CONFIG proxy.config.cluster.log_bogus_mc_msgs INT 1
CONFIG proxy.config.cluster.ethernet_interface STRING lo
##############################################################################
#
# Cache
#
##############################################################################
CONFIG proxy.config.cache.permit.pinning INT 0
   # default the ram cache size to AUTO_SIZE (-1) based on cache size
   #   (approximately 1 MB of RAM cache per GB of disk cache)
   # alternatively, set to a fixed value such as 20971520 (20MB)
CONFIG proxy.config.cache.ram_cache.size INT -1
CONFIG proxy.config.cache.ram_cache_cutoff INT 4194304
   # Replacement algorithm
   #  0 : Clocked Least Frequently Used by Size (CLFUS) w/optional compression
   #  1 : LRU w/o optional compression - trivially simple
CONFIG proxy.config.cache.ram_cache.algorithm INT 0
   # Compress the content of the ram cache:
   #  0 : no compression
   #  1 : fastlz (extremely fast, relatively low compression)
   #  2 : libz (moderate speed, reasonable compression)
   #  3 : liblzma (very slow, high compression)
   #  NOTE: compression runs on task threads.  To use more cores for
   #  compression, increase proxy.config.task_threads.
CONFIG proxy.config.cache.ram_cache.compress INT 0
   # The maximum number of alternates that are allowed for any given URL.
   # It is not possible to strictly enforce this if the variable
   #   'proxy.config.cache.vary_on_user_agent' is set to 1.
   # The default value for 'proxy.config.cache.vary_on_user_agent' is 0.
   # (0 disables the maximum number of alts check)
CONFIG proxy.config.cache.limits.http.max_alts INT 5
   # The target size of a contiguous fragment on disk.
   # Acceptable values are powers of 2, e.g. 65536, 131072, 262144, 524288, 1048576, 2097152.
   # Larger could waste memory on slow connections, smaller could waste seeks.
CONFIG proxy.config.cache.target_fragment_size INT 1048576
   # The maximum size of a document that will be stored in the cache.
   # (0 disables the maximum document size check)
CONFIG proxy.config.cache.max_doc_size INT 0
   # enable the cache to read from an object while it is being added to the cache
CONFIG proxy.config.cache.enable_read_while_writer INT 0
   # This controls how many objects (average) the disk caches can hold, and
   # how much memory it'll consume for the directory structure.
CONFIG proxy.config.cache.min_average_object_size INT 8000
   # How many I/O threads to allocate per disk (spindle). Be aware that RAID
   # disks would show up to TS as a single spindle.
CONFIG proxy.config.cache.threads_per_disk INT 8
   # Time (in ms) to delay until retrying to acquire a cache lock. Setting
   # this low can reduce latencies in some cases, but can consume more CPU.
   # If you experience CPU spinning, try increasing this setting.
CONFIG proxy.config.cache.mutex_retry_delay INT 2
##############################################################################
#
# DNS
#
##############################################################################
CONFIG proxy.config.dns.search_default_domains INT 1
CONFIG proxy.config.dns.splitDNS.enabled INT 0
CONFIG proxy.config.dns.max_dns_in_flight INT 2048
   # Additional URL expansions for http DNS lookup
CONFIG proxy.config.dns.url_expansions STRING NULL
CONFIG proxy.config.dns.round_robin_nameservers INT 0
CONFIG proxy.config.dns.nameservers STRING NULL
CONFIG proxy.config.dns.resolv_conf STRING /etc/resolv.conf
   # This provides additional resilience against DNS forgery, particularly in
   # forward or transparent proxies, but requires that the resolver populates
   # the queries section of the response properly.
CONFIG proxy.config.dns.validate_query_name INT 0
##############################################################################
#
# HostDB
#
##############################################################################
   # in entries, may not be changed while running
   # note that in order to increase hostdb.size, hostdb.storage_size should
   # also be increase. These are best guesses, you will have to monitor this.
CONFIG proxy.config.hostdb.size INT 120000
CONFIG proxy.config.hostdb.storage_size INT 33554432
   # ttl modes:
   #   0 = obey
   #   1 = ignore
   #   2 = min(X,ttl)
   #   3 = max(X,ttl)
CONFIG proxy.config.hostdb.ttl_mode INT 0
   # in minutes...
CONFIG proxy.config.hostdb.timeout INT 1440
   # round-robin addresses for single clients
   # (can cause authentication problems)
CONFIG proxy.config.hostdb.strict_round_robin INT 0
##############################################################################
#
# Logging Config
#
##############################################################################
   # possible values for logging_enabled:
   #   0: no logging at all
   #   1: log errors only
   #   2: log transactions only
   #   3: full logging (errors + transactions)
CONFIG proxy.config.log.logging_enabled INT 3
CONFIG proxy.config.log.max_secs_per_buffer INT 5
CONFIG proxy.config.log.max_space_mb_for_logs INT 25000
CONFIG proxy.config.log.max_space_mb_for_orphan_logs INT 25
CONFIG proxy.config.log.max_space_mb_headroom INT 1000
CONFIG proxy.config.log.hostname STRING localhost
CONFIG proxy.config.log.logfile_dir STRING var/log/trafficserver
CONFIG proxy.config.log.logfile_perm STRING rw-r--r--
CONFIG proxy.config.log.custom_logs_enabled INT 0
CONFIG proxy.config.log.squid_log_enabled INT 1
CONFIG proxy.config.log.squid_log_is_ascii INT 1
CONFIG proxy.config.log.squid_log_name STRING squid
CONFIG proxy.config.log.squid_log_header STRING NULL
CONFIG proxy.config.log.common_log_enabled INT 1
CONFIG proxy.config.log.common_log_is_ascii INT 1
CONFIG proxy.config.log.common_log_name STRING common
CONFIG proxy.config.log.common_log_header STRING NULL
CONFIG proxy.config.log.extended_log_enabled INT 0
CONFIG proxy.config.log.extended_log_is_ascii INT 0
CONFIG proxy.config.log.extended_log_name STRING extended
CONFIG proxy.config.log.extended_log_header STRING NULL
CONFIG proxy.config.log.extended2_log_enabled INT 1
CONFIG proxy.config.log.extended2_log_is_ascii INT 1
CONFIG proxy.config.log.extended2_log_name STRING extended2
CONFIG proxy.config.log.extended2_log_header STRING NULL
CONFIG proxy.config.log.separate_icp_logs INT 0
CONFIG proxy.config.log.separate_host_logs INT 0
   # Log collation allows you to do "remote logging"
LOCAL proxy.local.log.collation_mode INT 0
CONFIG proxy.config.log.collation_host STRING NULL
CONFIG proxy.config.log.collation_port INT 8085
CONFIG proxy.config.log.collation_secret STRING foobar
CONFIG proxy.config.log.collation_host_tagged INT 0
CONFIG proxy.config.log.collation_retry_sec INT 5
CONFIG proxy.config.log.rolling_enabled INT 1
CONFIG proxy.config.log.rolling_interval_sec INT 86400
CONFIG proxy.config.log.rolling_offset_hr INT 0
CONFIG proxy.config.log.rolling_size_mb INT 10
CONFIG proxy.config.log.auto_delete_rolled_files INT 1
CONFIG proxy.config.log.sampling_frequency INT 1
##############################################################################
#
# Reverse Proxy
#
##############################################################################
CONFIG proxy.config.reverse_proxy.enabled INT 1
CONFIG proxy.config.header.parse.no_host_url_redirect STRING NULL
##############################################################################
#
# URL Remap Rules
#
##############################################################################
CONFIG proxy.config.url_remap.default_to_server_pac INT 1
CONFIG proxy.config.url_remap.default_to_server_pac_port INT 1
   # To enable forward proxy, you must turn off remap_required
CONFIG proxy.config.url_remap.remap_required INT 1
   # Pristine host header is the "original" (request) header. Make sure your
   # origin expects them in reverse proxy.
CONFIG proxy.config.url_remap.pristine_host_hdr INT 1
##############################################################################
#
# SSL Termination
#
##############################################################################
   # proxy.config.ssl.enabled should be:
   #   0 - none
   #   1 - SSL enabled
CONFIG proxy.config.ssl.enabled INT 0
   # The number of SSL threads is a multiplier of number of CPUs and
   # proxy.config.exec_thread.autoconfig.scale by default. You can
   # override that here (set it to a non-zero value).
CONFIG proxy.config.ssl.number.threads INT 0
   # The following three variables can be
   # set to 0 to disable SSLv2, SSLv3, and/or TLSv1.
   # SSLv2 is disabled by default for security concern.
CONFIG proxy.config.ssl.SSLv2 INT 0
CONFIG proxy.config.ssl.SSLv3 INT 1
CONFIG proxy.config.ssl.TLSv1 INT 1
   # The following two variables control the Cipher Suite traffic Server
   # uses for HTTPS connnections and whether to prefer the client
   # selected (default) or the server selected
   # Our default SSL Cipher Suite tries to be reasonably fast and strong.
CONFIG proxy.config.ssl.server.cipher_suite STRING RC4-SHA:AES128-SHA:DES-CBC3-SHA:AES256-SHA:ALL:!aNULL:!EXP:!LOW:!MD5:!SSLV2:!NULL
CONFIG proxy.config.ssl.server.honor_cipher_order INT 0
CONFIG proxy.config.ssl.server_port INT 443
   # Client certification level should be:
   # 0 no client certificates
   # 1 client certificates optional
   # 2 client certificates required
CONFIG proxy.config.ssl.client.certification_level INT 0
   # Server cert filename is the name of the cert file
   # for a single cert system and the default cert name
   # for a multiple cert system.
CONFIG proxy.config.ssl.server.cert.filename STRING server.pem
   # Server cert chain filename is the name of the cert chain file
   # for a single cert system.
CONFIG proxy.config.ssl.server.cert_chain.filename STRING NULL
   # This is the path that will be used for both single and
   # multi cert systems.
CONFIG proxy.config.ssl.server.cert.path STRING etc/trafficserver
   # Fill in private key file and path only if the server's
   # private key is not contained in the server certificate file.
   # For multiple cert systems, if any private key is not contained
   # in the cert file, you must fill in the private key path.
CONFIG proxy.config.ssl.server.private_key.filename STRING NULL
CONFIG proxy.config.ssl.server.private_key.path STRING etc/trafficserver
   # The CA file name and path are the
   # certificate authority certificate that
   # client certificates will be verified against.
CONFIG proxy.config.ssl.CA.cert.filename STRING NULL
CONFIG proxy.config.ssl.CA.cert.path STRING etc/trafficserver
   ################################
   # client related configuration #
   ################################
CONFIG proxy.config.ssl.client.verify.server INT 0
CONFIG proxy.config.ssl.client.cert.filename STRING NULL
CONFIG proxy.config.ssl.client.cert.path STRING etc/trafficserver
   # Fill in private key file and path only if the client's
   # private key is not contained in the client certificate file.
CONFIG proxy.config.ssl.client.private_key.filename STRING NULL
CONFIG proxy.config.ssl.client.private_key.path STRING etc/trafficserver
   # The CA file name and path are the
   # certificate authority certificate that
   # server certificates will be verified against.
CONFIG proxy.config.ssl.client.CA.cert.filename STRING NULL
CONFIG proxy.config.ssl.client.CA.cert.path STRING etc/trafficserver
##############################################################################
#
# ICP Configuration. NOTE! ICP is currently broken NOTE!
#
##############################################################################
   # icp modes
   #   enabled=0 ICP disabled
   #   enabled=1 Allow receive of ICP queries
   #   enabled=2 Allow send/receive of ICP queries
CONFIG proxy.config.icp.enabled INT 0
CONFIG proxy.config.icp.icp_interface STRING NULL
CONFIG proxy.config.icp.icp_port INT 3130
CONFIG proxy.config.icp.multicast_enabled INT 0
CONFIG proxy.config.icp.query_timeout INT 2
##############################################################################
#
# Scheduled Update Configuration
#
##############################################################################
CONFIG proxy.config.update.enabled INT 0
CONFIG proxy.config.update.force INT 0
CONFIG proxy.config.update.retry_count INT 10
CONFIG proxy.config.update.retry_interval INT 2
CONFIG proxy.config.update.concurrent_updates INT 100
##############################################################################
#
# Socket send/recv buffer sizes (0 == don't call setsockopt() )
#
##############################################################################
   # out: proxy -> os connection
   # in : ua -> proxy connection
CONFIG proxy.config.net.sock_send_buffer_size_in INT 262144
CONFIG proxy.config.net.sock_recv_buffer_size_in INT 0
CONFIG proxy.config.net.sock_send_buffer_size_out INT 0
CONFIG proxy.config.net.sock_recv_buffer_size_out INT 0
##############################################################################
#
# User Overridden Configurations Below
#
##############################################################################
CONFIG proxy.config.core_limit INT -1
##############################################################################
#
# Debugging
#
##############################################################################
  # Uses a regular expression to match the debugging topic name, performance
  # will be affected!
CONFIG proxy.config.diags.debug.enabled INT 0
CONFIG proxy.config.diags.debug.tags STRING http.*|dns.*
  # Great for tracking down memory leaks, but you need to use the
  # ink allocators
CONFIG proxy.config.dump_mem_info_frequency INT 0
##############################################################################
#
# Slow Log
#
##############################################################################
  # Log any request that takes more then x number of milliseconds, needs
  # to be > 0 to be enabled
CONFIG proxy.config.http.slow.log.threshold INT 0
##############################################################################
#
# Thread pool for "misc" tasks, plugins etc. 2 is a good minimum.
#
##############################################################################
CONFIG proxy.config.task_threads INT 2
CONFIG proxy.config.cluster.cluster_configuration STRING cluster.config

3. remap.config

the line below should be added, first url points the url that proxy listenes the second one points the backend server.

map http://127.0.0.1:1212/ http://127.0.0.1:9015/

Saturday 24 March 2012

How to install Oracle 11g Express Edition (XE) to Ubuntu 11.10

There is a magnificent guide which shows how to install oracle xe to ubuntu I would like to share it helped me a lot.

https://forums.oracle.com/forums/thread.jspa?threadID=2301639

WARNING!!!!,

Installing Oracle XE to Ubuntu is literally pain in the butt. I got many errors eventhough I used that guide up there. Therefore I would like to share that what I needed to do after I installed oracle xe.

1. If you get an error like "initXE.ora has not been found". DON NOT rename

{oracle home for me it is /u01/app/oracle/product/11.2.0/xe}/product/dbs/init.ora to initXE.ora

if you see only init.ora under this path that means you haven't created your XE database yet. So it is simple

run this shell script

/u01/app/oracle/product/11.2.0/xe/bin/createdb.sh

this will take 5-10 minutes to recreate a new database.

2. if you get an error when you try to start sqlplus which says something about "libaio.so.1"  I don't remember either the name of the file or the problem, but problem stems from 32bit-64bit ubuntu library conflict. therefore you should install the 64 bit version of this library with

sudo apt-get install libaio1

Note: when oracle is installed to Ubuntu, it creates a new user account which is "oracle", and the password of this account is the password you entered when you run the /etc/init.d/oracle-xe configure. sqlplus is created by this account and only visible for this user. To use sqlplus you can log in with this user via the command line with

su - oracle

command.

Cheers.

Monday 19 December 2011

Audio Record Support for Android Emulator

To test your applications which use android AudioRecord calss, you should set this class's constructor with supported device properties. In the android documentation, it says Android devices support at least;
Sample rate: 44100Mhz
Channel Type: CHANNEL_IN_MONO
Encoding: ENCODING_PCM_16BIT

But unfortunately this is not correct. Because neither emulator nor my Samsung Galaxy S2 supports this configuration. I have just discovered that the correct initialization for the android emulator is


Sample rate: 8000Mhz
Channel Type: CHANNEL_IN_MONO
Encoding: ENCODING_PCM_16BIT

 this works for minimum buffer size calculation with getMinBufferSize(,,)

Cheers!

Sunday 21 August 2011

Why do we need non-static inner class in java


Non static inner classes can reach to its enclosing class elements because they are dynamic elements of their enclosing classes. You can do that.

class A {
     public void method(){}
     public class B {
     method(); // cannot do this if you define B as 'public static class B'
     }
}

And in this case (non-static inner class). If you d like to create an instance of you inner class (B) in some other class, you should instantiate it like below.

class C {
     public C(){
     A.B b = new A().new B(); // B has the same characteristic like other non-static class elements
     }
}

On the other hand if you aren't going to reach to the enclosing class elements from the inner class, you can define your inner class as static class. In this case you don't need to create an instance of enclosing class to create an instance of the inner class.


class C {
     public C(){
     A.B b = new A.B(); // this is a valid instantiation of a B's instance.
     }
}

Wednesday 3 August 2011

textview cannot be resolved to a type

There is that weird stuff in android. I have list_item.xml which is below

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:paddingLeft="6dip"
android:minHeight="?android:attr/listPreferredItemHeight"
></TextView>

and ArrayAdapter(view:View,textviewId:Int,items:String[]) wants a textview into 2nd parameter I was passing R.id.text1 as parameter but I needed to pass the layout (R.layout.list_item) instead of that textview. So why do you retrun 'textview cannot be resolved to a type' error to me? An example to confusing exceptions.

Saturday 28 May 2011

Add custom repository to maven and add a library (dependency) from this repository

If you add a dependency to your project's pom.xml file, everytime when you try to build your project maven tries to connect to maven's default libraries (http://repo1.maven.com ...) and returns with a error message which says it could not find source in maven default repositories. So: lets see how can you add your custom repositories to maven and dependencies to your projects.

Scenario: there is that myLib-200.jar with a groupId which is 'aliolcicode' under the http://repo.aliolci.com

1. You have to add that custom repository to your maven settings to inform maven that 'I use my custom repositories next to maven repositories'. To do this. open your maven settings file (click here to see how) and add these lines below, between 'mirrors' tags
in XML above the important part is the url part the others are definition of your custom repository.
<mirror>
<id>aliolci</id>
<name>aliolci code repository</name>
<url>http://repo.aliolci.com</url>
<mirrorof>*</mirrorof>
</mirror>
2. Add your dependency to your project. There is nothing special about this. Just add your dependency as usual into your projects pom.xml.
<dependencies>
<dependency>
<groupid>aliolcicode</groupid>
<artifactid>myLib</artifactid>
<version>200</version>
</dependency>
</dependencies>
That's it. Enjoy!