haproxy.conf
global
debug
frontend web1
bind *:8080
mode http
default_backend app1
backend app1
mode http
http-request set-header jwt %[req.cook(jwt_token)]
server s1 127.0.0.1:8000
versão haproxy
Nuster version 1.8.8.2.2
Copyright (C) 2017-2018, Jiang Wenyuan, <koubunen AT gmail DOT com >
HA-Proxy version 1.8.8.2 2018/05/29
Copyright 2000-2018 Willy Tarreau <[email protected]>
server.py
#!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
import logging
import time
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
logging.error(self.headers)
SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
Handler = GetHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
httpd.serve_forever()
curl
curl -v http://127.0.0.1:8080/xxx --cookie "jwt_token=asdf"
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /xxx HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.60.0
> Accept: */*
> Cookie: jwt_token=asdf
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: SimpleHTTP/0.6 Python/2.7.10
log do servidor.py:
User-Agent: curl/7.60.0
Accept: */*
Cookie: jwt_token=asdf
jwt: asdf
127.0.0.1 - - [08/Jun/2018 13:30:19] "GET /xxx HTTP/1.1" 200 -