-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1805 from weather-gov/jt/ip-address-filtering
ip address filtering for the `/jsonapi` endpoint
- Loading branch information
Showing
13 changed files
with
145 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
caddy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
debug | ||
log { | ||
format console | ||
level INFO | ||
output stdout | ||
} | ||
auto_https off | ||
|
||
servers { | ||
# treat this route service as a trusted proxy because the cloud.gov | ||
# router requires an X-Cf-Proxy-Signature (essentially an access token) | ||
# to confirm that a request has come through the route service. See: | ||
# https://docs.cloudfoundry.org/services/route-services.html#headers | ||
# this will set client_ip to the left-most X-Forwarded-For header. | ||
trusted_proxies static private_ranges | ||
} | ||
} | ||
|
||
:{$PORT} { | ||
# if the client_ip is not in the allowed list then it cannot access | ||
# the JSON:API endpoint. | ||
|
||
@denied not client_ip {$ALLOWED_IPS} | ||
|
||
# cloud.gov passes us the X-CF-Forwarded-Url, X-CF-Proxy-Signature, and | ||
# X-CF-Proxy-Metadata headers, but does not forward the path by default. | ||
# So we capture the X-CF-Forwarded-Url path to pass to the proxy. If no | ||
# such header is found, the routing is invalid and we return a 500. | ||
|
||
@loc header_regexp X-Cf-Forwarded-Url ^https://weathergov-{$SPACE_NAME}[^\/]+/(.*) | ||
|
||
handle @loc { | ||
rewrite /{re.loc.1} | ||
route { | ||
handle /jsonapi* { | ||
respond @denied 403 { | ||
close | ||
} | ||
reverse_proxy https://weathergov-{$SPACE_NAME}.apps.internal:61443 | ||
} | ||
reverse_proxy https://weathergov-{$SPACE_NAME}.apps.internal:61443 | ||
} | ||
} | ||
|
||
handle { | ||
respond "X-Cf-Forwarded-Url header not found" 500 { | ||
close | ||
} | ||
} | ||
|
||
log { | ||
format console | ||
level INFO | ||
output stdout | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters