Documentation ¶
Overview ¶
Package uwsgi provides http.Handler proxying requests to an uWSGI backend.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
Handler is a http.Handler that proxies requests to an uWSGI backend that can be connected to using dialFunc.
Usage example:
network, addr := "unix", "/path/to/uwsgi.socket" var d net.Dialer fn := func(ctx context.Context) (net.Conn, error) { return d.DialContext(ctx, network, addr) } log.Fatal(http.ListenAndServe("localhost:8080", uwsgi.Handler(fn)))
Handler sets some uWSGI-specific variables:
QUERY_STRING REQUEST_METHOD CONTENT_TYPE CONTENT_LENGTH REQUEST_URI PATH_INFO SERVER_PROTOCOL SERVER_NAME — value from the "Host:" header HTTPS — only set to "on" if request has https scheme or X-Forwarded-Proto: https header SERVER_PORT — set to "443" if request has https scheme or X-Forwarded-Proto: https header REMOTE_ADDR — either address of connected peer, or leftmost value from X-Forwarded-For header if present REMOTE_PORT — port of connected peer, if can be detected
Note the REMOTE_ADDR variable is populated from X-Forwarded-For if present — if server is exposed directly to the public network you may want to ensure this header is cleared before passing request to this Handler.
Click to show internal directories.
Click to hide internal directories.