← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~hyask/autopkgtest-cloud:skia/web_logs into autopkgtest-cloud:master

 

Skia has proposed merging ~hyask/autopkgtest-cloud:skia/web_logs into autopkgtest-cloud:master.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~hyask/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/467111

Pass client IP through proxy to ease blackholing bots and crawler, should the need arise.
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~hyask/autopkgtest-cloud:skia/web_logs into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py b/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py
index edafb41..c269d89 100644
--- a/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py
+++ b/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py
@@ -240,6 +240,8 @@ def set_up_web_config(apache):
 
         <VirtualHost *:80>
                 DocumentRoot {webcontrol_dir}
+
+                RemoteIPHeader X-Forwarded-For
                 ErrorLog ${{APACHE_LOG_DIR}}/error.log
                 CustomLog ${{APACHE_LOG_DIR}}/access.log combined
                 AddType 'text/plain' .log
diff --git a/mojo/service-bundle b/mojo/service-bundle
index df9cc07..be27bec 100644
--- a/mojo/service-bundle
+++ b/mojo/service-bundle
@@ -188,7 +188,7 @@ applications:
         num_units: 2
         constraints: mem=8G cores=2 root-disk=50G
         options:
-            enable_modules: include cgi proxy proxy_http
+            enable_modules: include cgi proxy proxy_http remoteip
             mpm_type: prefork
     autopkgtest-web:
         charm: ubuntu-release-autopkgtest-web
@@ -230,6 +230,8 @@ applications:
         num_units: 1
         expose: true
         options:
+            # Add 'forwardfor' to the default options
+            default_options: httplog, dontlognull, forwardfor
             services: |
 {%- if stage_name == "production" or stage_name == "staging" %}
                 - service_name: https_service
@@ -245,6 +247,7 @@ applications:
                       - timeout server 240s
                       - option httpchk HEAD / HTTP/1.0
                       - http-request set-header X-Forwarded-Proto https
+                      - http-request capture req.hdr(User-Agent) len 100
                       - "redirect prefix https://{{ hostname }} code 301 unless { hdr(host) -i {{ hostname }} }"
                   server_options: check inter 10000 rise 2 fall 5 maxconn 512 cookie S{i}
                 - service_name: http_redirect_to_https

Follow ups