Skip to content

Commit

Permalink
Fix advanced url rewrites with session meta and path params
Browse files Browse the repository at this point in the history
  • Loading branch information
buger committed Jan 25, 2018
1 parent 7f4efcd commit f4e4a94
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mw_url_rewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ func urlRewrite(meta *apidef.URLRewriteMeta, r *http.Request) (string, error) {
if len(triggerOpts.Options.PathPartMatches) > 0 {
total += 1
}
if len(triggerOpts.Options.SessionMetaMatches) > 0 {
total += 1
}
if triggerOpts.Options.PayloadMatches.MatchPattern != "" {
total += 1
}
Expand Down Expand Up @@ -243,6 +246,18 @@ func (m *URLRewriteMiddleware) InitTriggerRx() {
m.Spec.VersionData.Versions[verKey].ExtendedPaths.URLRewrite[pathKey].
Triggers[trKey].Options.QueryValMatches[key] = q
}
for key, h := range m.Spec.VersionData.Versions[verKey].ExtendedPaths.URLRewrite[pathKey].
Triggers[trKey].Options.SessionMetaMatches {
h.Init()
m.Spec.VersionData.Versions[verKey].ExtendedPaths.URLRewrite[pathKey].
Triggers[trKey].Options.SessionMetaMatches[key] = h
}
for key, h := range m.Spec.VersionData.Versions[verKey].ExtendedPaths.URLRewrite[pathKey].
Triggers[trKey].Options.PathPartMatches {
h.Init()
m.Spec.VersionData.Versions[verKey].ExtendedPaths.URLRewrite[pathKey].
Triggers[trKey].Options.PathPartMatches[key] = h
}
if m.Spec.VersionData.Versions[verKey].ExtendedPaths.URLRewrite[pathKey].
Triggers[trKey].Options.PayloadMatches.MatchPattern != "" {
m.Spec.VersionData.Versions[verKey].ExtendedPaths.URLRewrite[pathKey].
Expand Down

0 comments on commit f4e4a94

Please sign in to comment.