cgi "**.cgi|/cgi-bin/*" {
    enabled = true
    setenv  = { "MERECAT_TEST_VAR=hello_setenv" }
}

ssi "**.shtml" {
    enabled  = true
    cgi-path = "cgi-bin/ssi"
}

php "**.php*" {
    enabled  = true
}

server hej {
    port = 8086

    # Forward /proxy/** transparently (original URI preserved)
    proxy-pass "/proxy/**" {
        backend = "http://localhost:9090"
    }

    # Forward /v2proxy/** with path prefix stripping
    # GET /v2proxy/foo -> GET /v2/foo on the backend
    proxy-pass "/v2proxy/**" {
        backend = "http://localhost:9090/v2"
    }

    # Forward /strip/** stripping the prefix only (trailing slash, no sub-path)
    # GET /strip/hello -> GET /hello on the backend
    proxy-pass "/strip/**" {
        backend = "http://localhost:9090/"
    }

    # Forward /redir/** and rewrite Location: headers from backend
    # Backend returns: Location: http://localhost:9090/redir/target
    # Merecat rewrites:          Location: http://localhost/redir/target
    proxy-pass "/redir/**" {
        backend        = "http://localhost:9090"
        proxy-redirect = "http://localhost:9090 http://localhost:8086"
    }
}

server nej {
    port = 8080
    # If location is requested, replace with path
    location "/.secret/path/**" {
    	     path = "/img"
    }
    redirect "/**" {
    	     code = 301
    	     location = "http://$host:8086$request_uri$args"
    }
}
