You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.1 KiB

  1. From 91715c09a4595af6451ad97c43bf41fec107c69e Mon Sep 17 00:00:00 2001
  2. From: Willy Tarreau <w@1wt.eu>
  3. Date: Fri, 10 Mar 2017 11:49:21 +0100
  4. Subject: [PATCH 1/7] MINOR: config: warn when some HTTP rules are used in a
  5. TCP proxy
  6. Surprizingly, http-request, http-response, block, redirect, and capture
  7. rules did not cause a warning to be emitted when used in a TCP proxy, so
  8. let's fix this.
  9. This patch may be backported to older versions as it helps spotting
  10. configuration issues.
  11. (cherry picked from commit de7dc88c517e22d3ae02ce8a8a23046ab2c62238)
  12. ---
  13. src/cfgparse.c | 30 ++++++++++++++++++++++++++++++
  14. 1 file changed, 30 insertions(+)
  15. diff --git a/src/cfgparse.c b/src/cfgparse.c
  16. index fc6e149..d8d2fda 100644
  17. --- a/src/cfgparse.c
  18. +++ b/src/cfgparse.c
  19. @@ -8681,6 +8681,36 @@ out_uri_auth_compat:
  20. curproxy->uri_auth = NULL;
  21. }
  22. + if (curproxy->capture_name) {
  23. + Warning("config : 'capture' statement ignored for %s '%s' as it requires HTTP mode.\n",
  24. + proxy_type_str(curproxy), curproxy->id);
  25. + err_code |= ERR_WARN;
  26. + }
  27. +
  28. + if (!LIST_ISEMPTY(&curproxy->http_req_rules)) {
  29. + Warning("config : 'http-request' rules ignored for %s '%s' as they require HTTP mode.\n",
  30. + proxy_type_str(curproxy), curproxy->id);
  31. + err_code |= ERR_WARN;
  32. + }
  33. +
  34. + if (!LIST_ISEMPTY(&curproxy->http_res_rules)) {
  35. + Warning("config : 'http-response' rules ignored for %s '%s' as they require HTTP mode.\n",
  36. + proxy_type_str(curproxy), curproxy->id);
  37. + err_code |= ERR_WARN;
  38. + }
  39. +
  40. + if (!LIST_ISEMPTY(&curproxy->block_rules)) {
  41. + Warning("config : 'block' rules ignored for %s '%s' as they require HTTP mode.\n",
  42. + proxy_type_str(curproxy), curproxy->id);
  43. + err_code |= ERR_WARN;
  44. + }
  45. +
  46. + if (!LIST_ISEMPTY(&curproxy->redirect_rules)) {
  47. + Warning("config : 'redirect' rules ignored for %s '%s' as they require HTTP mode.\n",
  48. + proxy_type_str(curproxy), curproxy->id);
  49. + err_code |= ERR_WARN;
  50. + }
  51. +
  52. if (curproxy->options & (PR_O_FWDFOR | PR_O_FF_ALWAYS)) {
  53. Warning("config : 'option %s' ignored for %s '%s' as it requires HTTP mode.\n",
  54. "forwardfor", proxy_type_str(curproxy), curproxy->id);
  55. --
  56. 2.10.2