diff --git a/manifests/resource/location.pp b/manifests/resource/location.pp index c35c0cce5..a344ed277 100644 --- a/manifests/resource/location.pp +++ b/manifests/resource/location.pp @@ -91,6 +91,14 @@ # A single string, or an array of strings to append to the location directive # (after custom_cfg directives). NOTE: YOU are responsible for a semicolon on # each line that requires one. +# @param rewrite_by_lua +# Run the Lua source code inlined as the at the rewrite +# request processing phase. This does not replace the current access logs, +# but runs after. +# @param rewrite_by_lua_file +# Equivalent to rewrite_by_lua, except that the file specified by +# contains the Lua code, or, as from the v0.5.0rc32 +# release, the Lua/LuaJIT bytecode to be executed. # @param limit_zone # Apply a limit_req_zone to the location. Expects a string indicating a # previously defined limit_req_zone in the main nginx configuration @@ -303,6 +311,8 @@ Optional[String] $auth_basic = undef, Optional[String] $auth_basic_user_file = undef, Optional[String] $auth_request = undef, + Optional[String] $rewrite_by_lua = undef, + Optional[String] $rewrite_by_lua_file = undef, Array $rewrite_rules = [], Integer[401,599] $priority = 500, Boolean $mp4 = false, diff --git a/templates/server/location_header.erb b/templates/server/location_header.erb index e88e1b92c..15518206c 100644 --- a/templates/server/location_header.erb +++ b/templates/server/location_header.erb @@ -72,6 +72,12 @@ <%= line %> <%- end -%> <% end -%> +<% if defined? @rewrite_by_lua -%> + rewrite_by_lua '<%= @rewrite_by_lua %>'; +<% end -%> +<% if defined? @rewrite_by_lua_file -%> + rewrite_by_lua_file "<%= @rewrite_by_lua_file %>"; +<% end -%> <%- unless @rewrite_rules.nil? || @rewrite_rules.empty? -%> <%- @rewrite_rules.each do |rewrite_rule| -%> rewrite <%= rewrite_rule %>;