Forum OpenACS Q&A: Re: When using the revproxy module, how to rewrite the form

That worked! Thanks!

Here is what I did. In my package tcl directory I have a revproxy-init.tcl file with the filter registrations, rather than changing the request-processor-init.tcl file.

# pulled from acs-tcl/tcl/request-processor-init.tcl
    foreach httpMethod {PUT} {
        ns_register_filter preauth $httpMethod /resources/* rp_resources_filter
        ns_register_filter preauth $httpMethod * rp_filter
        ns_register_proc $httpMethod / rp_handler
    }
# the postauth filter registration is here

Do I need all three of those registrations? Also, in the request-processor-init.tcl the above filter registration calls are surrounded by a check and comment about making sure that they only run once.

if {[nsv_exists rp_properties request_count] == 0} {
    #
    # Run this only once at startup, and not on re-inits
    #
    nsv_set rp_properties request_count 0

    foreach httpMethod {GET HEAD POST} {
        ns_register_filter preauth $httpMethod /resources/* rp_resources_filter
        ns_register_filter preauth $httpMethod * rp_filter
        ns_register_proc $httpMethod / rp_handler
    }
}

I tried to put this same check around my register calls, but it failed the check and never entered to execute that code so my filters did not get registered. By the time the system is loading my package init file the request_count has incremented to 1. Do I need to worry about that? I do not know when "re-inits" occur. I can only assume that if the one filter registration is concerned about it I should also worry about it.