Skip to content

Commit fba59f9

Browse files
authored
Merge pull request #4344 from aapostoliuk/T7057-circinus
webproxy: T7057: Fixed 'domain-nocache' command
2 parents 9c9bb35 + 43ecb3c commit fba59f9

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

data/templates/squid/squid.conf.j2

+8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ acl BLOCKDOMAIN dstdomain {{ domain }}
3030
{% endfor %}
3131
http_access deny BLOCKDOMAIN
3232
{% endif %}
33+
34+
{% if domain_noncache is vyos_defined %}
35+
{% for domain in domain_noncache %}
36+
acl NOCACHE dstdomain {{ domain }}
37+
{% endfor %}
38+
no_cache deny NOCACHE
39+
{% endif %}
40+
3341
{% if authentication is vyos_defined %}
3442
{% if authentication.children is vyos_defined %}
3543
auth_param basic children {{ authentication.children }}

smoketest/scripts/cli/test_service_webproxy.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (C) 2020-2022 VyOS maintainers and contributors
3+
# Copyright (C) 2020-2025 VyOS maintainers and contributors
44
#
55
# This program is free software; you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License version 2 or later as
@@ -297,6 +297,22 @@ def test_05_basic_squidguard(self):
297297
# Check for running process
298298
self.assertTrue(process_named_running(PROCESS_NAME))
299299

300+
def test_06_nocache_domain_proxy(self):
301+
domains_nocache = ['test1.net', 'test2.net']
302+
self.cli_set(base_path + ['listen-address', listen_ip])
303+
for domain in domains_nocache:
304+
self.cli_set(base_path + ['domain-noncache', domain])
305+
# commit changes
306+
self.cli_commit()
307+
308+
config = read_file(PROXY_CONF)
309+
310+
for domain in domains_nocache:
311+
self.assertIn(f'acl NOCACHE dstdomain {domain}', config)
312+
self.assertIn(f'no_cache deny NOCACHE', config)
313+
314+
# Check for running process
315+
self.assertTrue(process_named_running(PROCESS_NAME))
300316

301317
if __name__ == '__main__':
302318
unittest.main(verbosity=2)

0 commit comments

Comments
 (0)