Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rewrite_by_lua option to locations #1548

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <rewrite-script-str> 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
# <path-to-lua-script-file> 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
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions templates/server/location_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>;
Expand Down