Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
mod_proxy_uwsgi: fix apache 2.4 integration with unix domain sockets
Example usage in apache conf:
ProxyPass "/foo" "unix:/var/run/uwsgi/foo.socket|uwsgi://uwsgi-uds-foo/"
Note: I use uwsgi-uds-foo as hostname instead of localhost because if
you have multiple entrie like these in the same apache conf, apache
thinks it is the same backend even though the unix socket path is
different. So it is mandatory to use different hostnames if you have
multiple app sockets.
Some references:
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=752783
- #973
- maybe #912
- #890- Loading branch information
There are no files selected for viewing
This file contains 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
| @@ -67,20 +67,18 @@ static int uwsgi_canon(request_rec *r, char *url) | ||
| } | ||
| url += sizeof(UWSGI_SCHEME); /* Keep slashes */ | ||
|
|
||
| err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port); | ||
| if (err) { | ||
| ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, | ||
| "error parsing URL %s: %s", url, err); | ||
| return HTTP_BAD_REQUEST; | ||
| } | ||
|
|
||
| if (port != UWSGI_DEFAULT_PORT) | ||
This comment has been minimized.
This comment has been minimized.
niol
Author
Contributor
|
||
| apr_snprintf(sport, sizeof(sport), ":%u", port); | ||
| else | ||
| sport[0] = '\0'; | ||
|
|
||
| if (ap_strchr(host, ':')) { /* if literal IPv6 address */ | ||
| host = apr_pstrcat(r->pool, "[", host, "]", NULL); | ||
| } | ||
Why is this change needed over here? It prevents proxying traffic on the default port 3031. So uswgi://127.0.0.1:3031 doesn't work, because apache tries to proxy it to uwsgi://127.0.0.1:0