Created
April 29, 2022 06:55
-
-
Save badri/f87441aa049f03c45de728010f686280 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
local base64 = require "ngx.base64" | |
local httpc = require("resty.http").new() | |
local base64_encode = base64.encode_base64url | |
local proxy_opts = {} | |
local auth_header = "Basic " .. base64_encode("holosix:xN186VaYjrCGepJI") | |
proxy_opts.http_proxy_authorization = auth_header | |
proxy_opts.http_proxy = "http://squid.kong-dp.svc.cluster.local:3128" | |
local res, err = httpc:request_uri("http://httpbin.kong-dp.svc.cluster.local:8000/uuid", { | |
method = "GET", | |
ssl_verify = false, | |
proxy_opts = proxy_opts, | |
}) | |
if not res then | |
ngx.log(ngx.ERR, "request failed: ", err) | |
return | |
end | |
local status = res.status | |
local length = res.headers["Content-Length"] | |
local body = res.body | |
ngx.log(ngx.ERR, "body: ", body) | |
ngx.log(ngx.ERR, "status: ", status) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment