Advertisement
Guest User

Untitled

a guest
Nov 16th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.43 KB | None | 0 0
  1. proxy_request = ->(env : HTTP::Server::Context) do
  2.   req = env.request
  3.  
  4.   req.path = "some_prefix" + req.path
  5.  
  6.   req.headers.delete("Accept-Encoding")
  7.   req.headers.delete("X-Auth-Token")
  8.  
  9.   response = HTTP::Client.new(
  10.     "new_host", 443, true
  11.   ).exec req
  12.  
  13.   env.response.headers.merge!(response.headers)
  14.   env.response.status_code = response.status_code
  15.   env.response.print response.body
  16.   env.response.flush
  17.   ""
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement