[uWSGI] uwsgi as an authentication proxy?

Roberto De Ioris roberto at unbit.it
Wed Apr 9 11:25:26 CEST 2014


> On Tue, 8 Apr 2014 08:54:11 +0200, "Roberto De Ioris"
> <roberto at unbit.it> wrote:
>>The part missing is the translation between hostname and ip addresses. It
>>is a bit of time i want to develop a c-ares plugin for uWSGI
>>(https://github.com/unbit/uwsgi/issues/310), if you can help me with
>>testing i can start working on it today (should not be a big effort)
>
> With pleasure.
>
> Besides, I'm probably not the only one who'd be interested in a
> solution to filter web pages on a smartphone, although having to leave
> Privoxy running on an appliance at home is more for the power-users
> type.
>
> _______________________________________________
> uWSGI mailing list
> uWSGI at lists.unbit.it
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>


Ok, build uwsgi from github and build the uwsgi-cares plugin:

uwsgi --build-plugin https://github.com/unbit/uwsgi-cares

(you need libc-ares-dev on debian/ubuntu)

the run it on port 9090 with this config:

[uwsgi]
; load c-ares plugin
plugins = cares
; bind on port 9090
http-socket = :9090
; spawn 2 offload threads (required for CONNECT support)
offload-threads = 2

; of REQUEST_METHOD is CONNECT goto proxyconnect
route-if = equal:${REQUEST_METHOD};CONNECT goto:proxyconnect
; if the REQUEST_URI is in the form http://domain/uri goto proxy
route = ^http://[a-z,A-Z,\-,0-9,\.]+/(.*) goto:proxy
; otherwise forbid !!!
route-run = break:403 Forbidden

; the http proxy
route-label = proxy
; remove the domain from the uri
route-uri = ^http://[a-z,A-Z,\-,0-9,\.]+/(.*) seturi:/$1
; adjust port (if != 80)
route-if-not = contains:${HTTP_HOST};: http:${dns[HTTP_HOST]}:80
; forward the request
route-run = http:${dns[HTTP_HOST]}

; the https proxy
route-label = proxyconnect
route-run = httpconnect:${dns[PATH_INFO]}


Note:

i have sent this email using firefox and this proxy configuration :)


-- 
Roberto De Ioris
http://unbit.it


More information about the uWSGI mailing list