diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2020-09-29 18:21:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-29 18:21:04 +0000 |
commit | effc1eb54773a446770a551cafa771d4c0c022d6 (patch) | |
tree | 8280a44b1fe957979ee7caad7ebb810b8d2c9b7f /web | |
parent | 61d7e23eed0503bf591274df70713970213b5c7f (diff) |
Add missing tests (#10008)
Diffstat (limited to 'web')
-rw-r--r-- | web/server/web_client.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/web/server/web_client.c b/web/server/web_client.c index 88030352b6..9f4a0f43b8 100644 --- a/web/server/web_client.c +++ b/web/server/web_client.c @@ -814,10 +814,12 @@ static inline char *http_header_parse(struct web_client *w, char *s, int parse_u } } #endif /* NETDATA_WITH_ZLIB */ +#ifdef ENABLE_HTTPS else if(hash == hash_forwarded_proto && !strcasecmp(s, "X-Forwarded-Proto")) { if(strcasestr(v, "https")) w->ssl.flags |= NETDATA_SSL_PROXY_HTTPS; } +#endif else if(hash == hash_forwarded_host && !strcasecmp(s, "X-Forwarded-Host")){ strncpyz(w->forwarded_host, v, ((size_t)(ve - v) < sizeof(w->server_host)-1 ? (size_t)(ve - v) : sizeof(w->server_host)-1)); } @@ -1352,7 +1354,11 @@ static inline int web_client_switch_host(RRDHOST *host, struct web_client *w, ch if(!url) { //no delim found debug(D_WEB_CLIENT, "%llu: URL doesn't end with / generating redirect.", w->id); char *protocol, *url_host; +#ifdef ENABLE_HTTPS protocol = ((w->ssl.conn && !w->ssl.flags) || w->ssl.flags & NETDATA_SSL_PROXY_HTTPS) ? "https" : "http"; +#else + protocol = "http"; +#endif url_host = (!w->forwarded_host[0])?w->server_host:w->forwarded_host; buffer_sprintf(w->response.header, "Location: %s://%s%s/\r\n", protocol, url_host, w->last_url); buffer_strcat(w->response.data, "Permanent redirect"); |