Commit Graph

260 Commits

Author SHA1 Message Date
e36237899d * Temporarily add back the query string to the URL as it might contain the
routing information for sticky sessions.

PR: 69443


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1925109 13f79535-47bb-0310-9956-ffa450edef68
2025-04-16 11:29:25 +00:00
6433e92520 * Do not add a space before '|' when setting the value for stickysession in the
balancer manager as this breaks the stickysession configuration once a new
  configuration is submitted by the balancer manager.

PR: 69510
Submitted by: Yutaka Tokunou <tokunou.yutaka@fujitsu.com>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1923101 13f79535-47bb-0310-9956-ffa450edef68
2025-01-13 13:37:40 +00:00
6716ada174 mod_proxy: Fix canonicalisation and FCGI env (PATH_INFO, SCRIPT_NAME) for
"balancer:" URLs set via SetHandler, also allowing for "unix:"
           sockets with BalancerMember(s).  PR 69168.

* modules/proxy/proxy_util.h, modules/proxy/proxy_util.c:
  Move proxy_interpolate() from mod_proxy.c to ap_proxy_interpolate(),
  exported locally only (non public).
  Move proxy_fixup() from mod_proxy.c to ap_proxy_canon_url(), exported
  locally only too (non public).
  Rollback ap_proxy_fixup_uds_filename() to a local fixup_uds_filename()
  usable from proxy_util.c only. The public function will be removed in
  a following commit.

* modules/proxy/mod_proxy.h:
  Note that ap_proxy_fixup_uds_filename() is deprecated.

* modules/proxy/mod_proxy.c:
  Just use ap_proxy_canon_url() from proxy_fixup() and proxy_handler()
  for SetHandler URLs.

* modules/proxy/mod_proxy_balancer.c:
  Do not canonicalize the path from proxy_balancer_canon() anymore but
  rather from balancer_fixup() where the balancer URL is rewritten to
  the BalancerMember URL.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1919022 13f79535-47bb-0310-9956-ffa450edef68
2024-07-08 13:59:50 +00:00
aa4b05ee05 * Always trust content types that we set literally
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918814 13f79535-47bb-0310-9956-ffa450edef68
2024-07-02 06:35:53 +00:00
cfee7ee407 mod_proxy: Follow up to r1912245: ap_proxy_ prefix for extern functions.
Even if they are not part of the API (not in mod_proxy.h) hence requires no
MMN bump, {get,set,increment_,decrement_}busy_count() being AP_PROXY_DECLARE()d
could name-collide with a third-party module's functions.

Rename them using the ap_proxy_ prefix, with an underscore after the verb for
for all of them too (for consistency), that is:
    ap_proxy_{get,set,increment,decrement}_busy_count()



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1913930 13f79535-47bb-0310-9956-ffa450edef68
2023-11-18 13:49:04 +00:00
8eb0f9e253 mod_proxy: Allocate and pnitialize the workers and balancers on pconf.
On ungraceful restart, pchild might be destroyed without waiting for the MPM
threads, just before exit()ing but still there is a window where threads may
be using its data still.

Avoid possible exit path crashes by basing the workers/balancers on pconf,
which is not destroyed in children processes.

While at it, avoid the duplication of the generic "forward" worker for each
server(_rec), there can be a single instance like the generic "reverse"
worker.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1912463 13f79535-47bb-0310-9956-ffa450edef68
2023-09-21 13:44:51 +00:00
29fb603784 mod_proxy: Add ap_proxy_worker_get_name() and deprecate ap_proxy_worker_name().
The latter requires a pool and returns a non constant string although it may
return worker shared data.

By computing the worker "UDS" name at init time we can return a constant name
in any case with no need for a pool, that's the new ap_proxy_worker_get_name().



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1912461 13f79535-47bb-0310-9956-ffa450edef68
2023-09-21 13:31:15 +00:00
1b9292a4c9 Arrange the bybusyness logic and prevent bad busy values
this closes #383


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1912245 13f79535-47bb-0310-9956-ffa450edef68
2023-09-11 13:50:21 +00:00
2eceb6a9fe mod_proxy: Check for space/ctrls in nocanon path/urls before forwarding.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1908827 13f79535-47bb-0310-9956-ffa450edef68
2023-03-31 00:11:02 +00:00
6e75fe3b52 * Whitespace fixes. No functional change.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1908628 13f79535-47bb-0310-9956-ffa450edef68
2023-03-22 08:01:31 +00:00
2fa15c2c06 Do not double encode encoded slashes
In case that AllowEncodedSlashes is set to NoDecode do not double encode
encoded slashes in the URL sent by the reverse proxy to the backend.

* include/ap_mmn.h: Document the addition of ap_proxy_canonenc_ex to the API.

* modules/proxy/mod_proxy.h: Declare ap_proxy_canonenc_ex and define flag
      values.

* modules/proxy/proxy_util.c: Implement ap_proxy_canonenc_ex by modifying
      ap_proxy_canonenc accordingly and reimplement ap_proxy_canonenc to
      use ap_proxy_canonenc_ex with the appropriate flag.

* modules/http2/mod_proxy_http2.c, modules/proxy/mod_proxy_*.c: Set the
      correct flag based on the AllowEncodedSlashes configuration and use
      ap_proxy_canonenc_ex instead of ap_proxy_canonenc.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1908341 13f79535-47bb-0310-9956-ffa450edef68
2023-03-13 10:24:30 +00:00
542804c63b mod_proxy: Check the query-string for proxy-noencode too.
Follow up to r1907972 and r1908095.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1908257 13f79535-47bb-0310-9956-ffa450edef68
2023-03-10 21:02:31 +00:00
d78a166fed don't forward invalid query strings
Submitted by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1908095 13f79535-47bb-0310-9956-ffa450edef68
2023-03-05 20:27:11 +00:00
52930446f6 mod_proxy: Don't decode r->uri and reencode in r->filename for mapping=encoded.
Decoding was not done for mapping=servlet only (a subset), but overlooked for
mapping=encoded. To avoid double-encoding in the canon_handler hook, use a new
"proxy-noencode" (similarly to "proxy-nocanon") entry in r->notes.

* proxy/mod_proxy.c(ap_proxy_trans_match):
  Set "proxy-noencode" in r->notes for PROXYPASS_MAP_ENCODED, and return DONE
  to avoid decoding in ap_process_request_internal().

* proxy/mod_proxy_http.c, proxy/mod_proxy_ajp.c, proxy/mod_proxy_wstunnel.c,
  proxy/mod_proxy_fcgi.c, proxy/mod_proxy_ajp.c, http2/mod_proxy_http2.c:
  Don't process the url through ap_proxy_canonenc() in canon_handler if
  "proxy-noencode" is set.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1907972 13f79535-47bb-0310-9956-ffa450edef68
2023-03-02 14:30:20 +00:00
2d4d303201 *) mod_proxy: Add backend port to log messages to
ease identification of involved service.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1900028 13f79535-47bb-0310-9956-ffa450edef68
2022-04-19 09:14:10 +00:00
1153a2d5d3 Add some missing space in HTML
Sumitted by Todd Lewis <utoddl email.unc.edu>
PR 65287

[skip ci]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889494 13f79535-47bb-0310-9956-ffa450edef68
2021-05-04 16:39:56 +00:00
9e2ed5bb85 max_attempts_set needs to be set too.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1888518 13f79535-47bb-0310-9956-ffa450edef68
2021-04-08 12:35:44 +00:00
f5fbe0f338 Add CPING to health check logic.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1887415 13f79535-47bb-0310-9956-ffa450edef68
2021-03-10 10:36:46 +00:00
6cbbf4f0b1 Use an optional function as adviced by Rüdiger.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1887359 13f79535-47bb-0310-9956-ffa450edef68
2021-03-09 08:39:21 +00:00
2d78b26ab9 * modules/proxy/mod_proxy_balancer.c (balancer_display_page):
Include nonce in XML output.

PR: 63074
Submitted by: Federico Mennite <federico.mennite lifeware.ch>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1887192 13f79535-47bb-0310-9956-ffa450edef68
2021-03-05 08:35:06 +00:00
08490d8aaf Add balancer_manage() to allow external module to fill workers for balancers.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1887176 13f79535-47bb-0310-9956-ffa450edef68
2021-03-04 14:00:45 +00:00
00940b1ea9 Simplify balancer-manager XSS protection, no functional change:
* modules/proxy/mod_proxy_balancer.c (balancer_process_balancer_worker):
  Drop the ok2change parameter, which makes the function a noop, and
  require the function is not called for that case.
  (balancer_handler): Only call balancer_process_balancer_worker if
  the nonce matches.  Simplify call to balancer_display_page. 

Github: closes #174


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1887144 13f79535-47bb-0310-9956-ffa450edef68
2021-03-03 14:27:33 +00:00
8008cb3600 rollback r1887138. Sorry ;-(
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1887143 13f79535-47bb-0310-9956-ffa450edef68
2021-03-03 13:21:27 +00:00
89d543337b Allow empty <balancer://mycluster/> and add a provider to allow other modules to create workers.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1887138 13f79535-47bb-0310-9956-ffa450edef68
2021-03-03 11:01:02 +00:00
79739abe66 mod_proxy: pconf vs pchild consistency, and correctness in ONE_PROCESS mode.
Consistently use pconf for ap_proxy_define_{worker,balancer}() and pchild for
ap_proxu_initialize_{worker,balancer}() in mod_proxy [child_]init code.

pchild is needed in _initialize() for mutexes/shms' child_init and cleanup,
and to avoid a crash on shutdown (i.e. ap_terminate) in ONE_PROCESS mode,
where worker->cp->pool is destroyed twice, let's register conn_pool_cleanup()
as a pre_cleanup of pchild.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1883744 13f79535-47bb-0310-9956-ffa450edef68
2020-11-23 11:03:45 +00:00
0fa2bb2b2f Add a missing </tr>
PR 64754

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1882210 13f79535-47bb-0310-9956-ffa450edef68
2020-10-03 06:07:55 +00:00
85760859ca Fix spelling errors found by codespell. [skip ci]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873985 13f79535-47bb-0310-9956-ffa450edef68
2020-02-13 18:15:57 +00:00
fbecdc0f1e PR62989: DOCTYPE tags in server-generated HTML.
Submitted By: Andra Farkas <deepbluemistake gmail.com>, Giovanni Bechis <giovanni paclan.it>




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873397 13f79535-47bb-0310-9956-ffa450edef68
2020-01-31 02:38:05 +00:00
fece93508b restore use of global mutex under !APR_HAS_THREADS
followup to r1852442 which appears to have been too agressive in wrapping
blocks with #if APR_HAS_THREADS.  With !APR_HAS_THREADS a global mutex 
is a proc mutex.




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1866145 13f79535-47bb-0310-9956-ffa450edef68
2019-08-30 11:58:41 +00:00
0951669df6 PR63688 balancer csrf problems
fix case-sensitive referer check

Submitted By: Armin Abfalterer 



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1865749 13f79535-47bb-0310-9956-ffa450edef68
2019-08-23 13:06:57 +00:00
8a339ed1ec * modules/proxy/mod_proxy_balancer.c (balancer_display_page):
Add more HTML-escaping.

Submitted by: Niels Heinen <heinenn google.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1864703 13f79535-47bb-0310-9956-ffa450edef68
2019-08-08 14:00:03 +00:00
ed70569bf5 * modules/proxy/mod_proxy_balancer.c (balancer_handler): Check Referer
to improve on protection against balancer-manager XSRF attacks
  provided by the nonce.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1864695 13f79535-47bb-0310-9956-ffa450edef68
2019-08-08 12:11:36 +00:00
7f1e163de0 Follow up to r1847232.
There is no point to use "old" numbers in recent commit.

Also avoid number duplication. The messages are the same but in different code path, so having different numbers makes sense.
This also avoids a warning when running:
   make update-log-msg-tags

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1861333 13f79535-47bb-0310-9956-ffa450edef68
2019-06-14 11:46:18 +00:00
fa4eb1f879 Arrange balancer_handler() to be able to call
balancer_process_balancer_worker() to create/enable/disable
workers from another modules via a provider.
No functional changes in this first commit.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1859235 13f79535-47bb-0310-9956-ffa450edef68
2019-05-14 15:26:08 +00:00
c66bef968e Fix some HTML syntax issues.
PR 63095 (Masahiro IMABAYASHI, <masahiro.imabayashi sony.com>)

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1855614 13f79535-47bb-0310-9956-ffa450edef68
2019-03-15 20:38:45 +00:00
3ee1b624b8 Make proxy modules compile if APR_HAS_THREADS is not defined.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1852442 13f79535-47bb-0310-9956-ffa450edef68
2019-01-29 12:28:35 +00:00
3552227669 Arrange the xml display and make it uses xml.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1847295 13f79535-47bb-0310-9956-ffa450edef68
2018-11-23 17:10:45 +00:00
9d74d0c874 fix incorrect rv. Sorry.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1847234 13f79535-47bb-0310-9956-ffa450edef68
2018-11-23 09:36:36 +00:00
e4b68ca5fc Add error messages and return bad request.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1847232 13f79535-47bb-0310-9956-ffa450edef68
2018-11-23 09:32:20 +00:00
2acd655200 * Always retrieve conditional function. static variable might contain garbage if module was reloaded in a static build.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1836383 13f79535-47bb-0310-9956-ffa450edef68
2018-07-20 19:36:01 +00:00
33bd5995b0 mod_proxy_balancer: clear slotmem slots' inuse flags from persisted files.
Otherwise, when BalancerPersist is enabled, we might fail (re)starting with a
saved slotmem if a BalancerMember was renamed (e.g. PR 62308's port change).
This is because the renamed member is considered a new one, while the old name
still reserves a slot, so we end up missing one room. The overall number of
members does not change so the sizes check succeeds thus the persisted slotmem
is not invalidated. Yet the slomem is not really compatible.

By clearing inuse flags, we still allow for slots to be reused if their index
did not change (thanks to ap_proxy_find_balancershm() and slotmem_fgrab() at
the given index), but will also invalidate renamed slots which don't match the
index. We now have the correct behaviour by slot and the server (re)starts in
any case.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1831938 13f79535-47bb-0310-9956-ffa450edef68
2018-05-20 13:08:13 +00:00
76418da90b Revert r1831218, the API garantees slotmem_attach() is called in child_init().
r1831394 is the right follow to r1830800 to preserve "inherited" slotmems in
children processes.

While at it, comment on the expectations from mod_proxy_balancer w.r.t.
slotmem_attach() implementations, and eventually how we could improve the API
later (w/o backporting to 2.4.x).



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1831396 13f79535-47bb-0310-9956-ffa450edef68
2018-05-11 09:44:38 +00:00
21cdbc9854 mod_proxy_balancer: follow up to r1830800.
Don't call slotmem_attach() if the slot is already initialized/reused, that
used to work previously because the returned error status is ignored, but
r1830800 changed the function to forcibly reset the returned slot pointer to
NULL first.

There is no point to call slotmem_attach() in this case, the slot is already
initialized because it's either inherited/fork()ed on Unixes, or on Windows
the attachment happened in post_config/slotmem_create() already.

One case where slotmem_attach() would fail is when balancers are defined
globally (main server) and some virtualhosts don't have/use any mod_proxy
configuration/directive. In this case their proxy server config is a pointer
copy of the main server thus their slots are already initialized in both
post_config and child_init hooks. While the case was already handled in
the balancer_post_config(), it did not in balancer_child_init() where we
relied on slotmem_attach() to be a noop.

[Reverted by r1831396]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1831218 13f79535-47bb-0310-9956-ffa450edef68
2018-05-09 01:23:59 +00:00
55b4505765 mod_proxy_balancer: Add hot spare member type and corresponding flag (R). Hot spare members are
used as drop-in replacements for unusable workers in the same load balancer set. This differs
from hot standbys which are only used when all workers in a set are unusable. PR 61140.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1828890 13f79535-47bb-0310-9956-ffa450edef68
2018-04-11 12:11:05 +00:00
fac7f995b0 mod_proxy: Provide an RFC1035 compliant version of the hostname in the
proxy_worker_shared structure. PR62085


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1824176 13f79535-47bb-0310-9956-ffa450edef68
2018-02-13 21:22:05 +00:00
fad6cd0e46 mod_proxy_balancer: follow up tp r1822509.
Rework server_rec ID so that it doesn't change on restart (or stop/start)
unless it's Host(s)/IP(s):port(s), ServerName and/or ServerAlias(es) changed.

The goal being to reuse SHMs (and persisted files) names as much as possible,
with minimal bindings to configuration changes (as far as mod_proxy_balancer
is concerned). So if the ServerName and first Host/IP:port are unique we use
that first, otherwise the ServerAlias(es) and other Host(s)/IP(s):port(s) are
also taken into account, and finally if that's still not enough the server
index is also used (pathological case handled for correctness with regard to
the underlying mod_slotmem_shm's reuse code).



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1823564 13f79535-47bb-0310-9956-ffa450edef68
2018-02-08 15:08:09 +00:00
37578399ef Revert r1822800 and r1822804.
All was already there, I just misread name vs sname :/



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1822806 13f79535-47bb-0310-9956-ffa450edef68
2018-01-31 14:25:53 +00:00
7c2fce4a11 mod_proxy_balancer: follow up tp r1822509 and r1822800.
Actually we already have an (per vhost) unique id for the balancer, so use it.

[Reverted by r1822806]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1822804 13f79535-47bb-0310-9956-ffa450edef68
2018-01-31 14:15:03 +00:00
bf336e8280 mod_proxy_balancer: follow up tp r1822509.
Use a unique balancer id per vhost for workers' slotmem too.

[Reverted by r1822806]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1822800 13f79535-47bb-0310-9956-ffa450edef68
2018-01-31 13:55:53 +00:00
84cabd2d8e Revert r1813167 (per review).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1813255 13f79535-47bb-0310-9956-ffa450edef68
2017-10-25 07:23:34 +00:00