Parsnips.net Like a Carrot

22Mar/120

Documentation over tests

I'd rather have documentation than tests. Here's a concrete example of a horrible documentation fail. Take a look at the configuration example:


    ...
    
        cross-origin
        org.eclipse.jetty.servlets.CrossOriginFilter
    
    
        cross-origin
        /cometd/*
    
    ...

Are you kidding me? Dot Dot Dot?? What other configuration options are there? Using googlefu you come across questions like this. The poster in this case has no idea that for example allowedMethods and allowedHeaders cannot have * as a value... Because the documentation said so? No, because as we see the documentation doesn't even include these options as configuration value ... Unless you know what the prior punctuation somehow magically means.

So after looking up the code. I know what a valid configuration document should look like. What's wrong with that picture, SOLID people?

For a cross origin pre-flight request in jetty, you have to specify the headers to include ... And ... Then ... You also have ... to ... specify ... the ... actual ... HTTP ... Verbs ... That ... You'll ... Apply ...


   		cross-origin
   		org.eclipse.jetty.servlets.CrossOriginFilter
   		
       		allowedOrigins
       		*
   		
   		
       		allowedMethods
       		GET,POST,HEAD,PUT,DELETE
   		
		
			allowedHeaders
		    X-Requested-With,Content-Type,Accept,Origin,x-custom-header
		
 	

Give me documentation, or give me death. - Patrick Henry

27Nov/110

haproxy http to https redirect

For those who are lazy, and don't want to understand haproxy thaaat well. In order to redirect all traffic from http to https use a variation of the following in your haproxy.cfg

#---------------------------------------------------------------------
# Redirect to secured
#---------------------------------------------------------------------
frontend unsecured *:80
    redirect location https://foo.bar.com

#---------------------------------------------------------------------
# frontend secured
#---------------------------------------------------------------------
frontend  secured *:443
   mode  tcp 
   default_backend		app

#---------------------------------------------------------------------
# round robin balancing between the various backends
#---------------------------------------------------------------------
backend app
    mode  tcp
    balance roundrobin
    server  app1 127.0.0.1:5001 check
    server  app2 127.0.0.1:5002 check
    server  app3 127.0.0.1:5003 check
    server  app4 127.0.0.1:5004 check