Skip to content

Commit

Permalink
Merge pull request #14 from opensrp/fix-bug-on-internal-proxy
Browse files Browse the repository at this point in the history
fix bug on internal proxy
  • Loading branch information
bennsimon authored Apr 29, 2021
2 parents c40cd9c + d890f09 commit fdffbb7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions charts/opensrp-server-web/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.6
version: 0.1.7

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: v2.6.8-SNAPSHOT
appVersion: v2.6.9-SNAPSHOT
4 changes: 2 additions & 2 deletions charts/opensrp-server-web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,6 @@ The following table lists the configurable parameters of the Opensrp-server-web
| `tomcatRemoteIpValve.protocolHeader` | | `"x-forwarded-proto"` |
| `tomcatRemoteIpValve.proxiesHeader` | | `"x-forwarded-by"` |
| `tomcatRemoteIpValve.remoteIpHeader` | | `"x-forwarded-for"` |
| `tomcatRemoteIpValve.hostOctetPortion` | `hostOctetPortion (4 < x > 0 )` | `2` |
| `tomcatRemoteIpValve.internalProxies` | `dynamically populated if not specified, control the hostPortion by updating tomcatRemoteIpValve.hostOctetPortion e.g for 2 is equivalent to ip/16` | `nil` |
| `hostOctetPortion` | `hostOctetPortion (4 < x > 0 )` | `2` |
| `tomcatRemoteIpValve.internalProxies` | `dynamically populated if not specified, control the hostPortion by updating hostOctetPortion e.g for 2 is equivalent to ip/16` | `nil` |
| `useTomcatRemoteIpValve` | | `false` |
4 changes: 2 additions & 2 deletions charts/opensrp-server-web/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ Find the podCIDRPattern
{{- $node := (lookup "v1" "Node" .Release.Namespace "") -}}
{{- if and $node $node.items -}}
{{- $firstNode := ($node.items | first) -}}
{{- $hostPortion := (int .Values.tomcatRemoteIpValve.hostOctetPortion) -}}
{{- $hostPortion := (int .Values.hostOctetPortion) -}}
{{- if and ($firstNode) ($firstNode.spec) ($firstNode.spec.podCIDR) -}}
{{- if and ( kindIs "int" $hostPortion ) (gt $hostPortion 0) (lt $hostPortion 4) -}}
{{- $podCIDR := (regexFind (repeat $hostPortion ".\\d{1,3}.") $firstNode.spec.podCIDR) | trimSuffix "." -}}
{{- $podCIDRPattern := (cat $podCIDR (repeat (int (sub 4 $hostPortion)) ".d{1,3}")) | nospace | replace "." "\\." -}}
{{- $podCIDRPattern := (cat $podCIDR (repeat (int (sub 4 $hostPortion)) ".\\d{1,3}")) | nospace | replace "." "\\." -}}
{{- $podCIDRPattern -}}
{{- end }}
{{- end }}
Expand Down
3 changes: 2 additions & 1 deletion charts/opensrp-server-web/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ tomcatRemoteIpValve:
remoteIpHeader: 'x-forwarded-for'
proxiesHeader: 'x-forwarded-by'
protocolHeader: 'x-forwarded-proto'
hostOctetPortion: 2

hostOctetPortion: 2


# Recreates pods when configMap changes, default is true
Expand Down

0 comments on commit fdffbb7

Please sign in to comment.