Sample application demonstrating use of vgs-proxy-spring library.
The application is a router to httpbin service, the values which are sent to it are redacted via reverse proxy and revealed on request to httpbin via forward proxy.
- Install ngrok
- Start ngrok with
ngrok http 8080
- Go to VGS Dashboard
- Create sandbox vault and configure the routes the following way (use your ngrok address for Inbound destination url):
- Add your forward proxy url to
application.properties
replacing<USERNAME>
and<PASSWORD>
with your proxy credentials - Start the
httpbin-router
app withmvn spring-boot:run
- Send a curl request to verify request is proxied via VGS:
curl https://tntgssc4gig.SANDBOX.verygoodproxy.com/post \
-H "Content-type: application/json" \
-d '{"secret": "foo"}'
- Check the logs for redacted
secret
value using VGS proxy:
2018-07-20 12:24:01.974 INFO 88278 --- [nio-8080-exec-1] com.verygoodsecurity.HttpBinRouter : Redacted JSON using VGS reverse proxy:
{"secret":"tok_sandbox_dSDFUJwihGCSVwcsKWEJfa"}
- Check the logs for revealed
secret
value using VGS proxy:
2018-07-20 12:24:03.531 INFO 88278 --- [nio-8080-exec-1] com.verygoodsecurity.HttpBinRouter : Revealed JSON after sending via VGS forward proxy:
{
"args": {},
"data": "{\"secret\":\"foo\"}",
"files": {},
"form": {},
"headers": {
"Accept": "text/plain, application/json, application/*+json, */*",
"Accept-Encoding": "gzip,deflate",
"Connection": "close",
"Content-Length": "16",
"Content-Type": "text/plain;charset=ISO-8859-1",
"Host": "httpbin.verygoodsecurity.io",
"User-Agent": "Apache-HttpClient/4.5.2 (Java/1.8.0_151)",
"Vgs-Request-Id": "cc0cbf4e84bc3fef",
"Via": "1.1 3c455ebab049"
},
"json": {
"secret": "foo"
},
"origin": "52.6.216.177, 172.31.2.130",
"url": "https://httpbin.verygoodsecurity.io/post"
}