summaryrefslogtreecommitdiff
path: root/src/conf_mode/http-api.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2021-12-15 14:45:25 -0600
committerJohn Estabrook <jestabro@vyos.io>2021-12-15 15:35:39 -0600
commit55f8ede2d09a9ad095f9ec5c2a729f8c5fb6aafa (patch)
tree6d84d2b3f1ace7e43bca200be66226ebf973dd04 /src/conf_mode/http-api.py
parent25d95b1f73f3e5e0fd2dfc9199f46d808c68af43 (diff)
downloadvyos-1x-55f8ede2d09a9ad095f9ec5c2a729f8c5fb6aafa.tar.gz
vyos-1x-55f8ede2d09a9ad095f9ec5c2a729f8c5fb6aafa.zip
http-api: T4076: allow setting CORS option 'Access-Control-Allow-Origin'
Diffstat (limited to 'src/conf_mode/http-api.py')
-rwxr-xr-xsrc/conf_mode/http-api.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/conf_mode/http-api.py b/src/conf_mode/http-api.py
index cd0191599..ea0743cd5 100755
--- a/src/conf_mode/http-api.py
+++ b/src/conf_mode/http-api.py
@@ -67,6 +67,12 @@ def get_config(config=None):
port = conf.return_value('port')
http_api['port'] = port
+ if conf.exists('cors'):
+ http_api['cors'] = {}
+ if conf.exists('cors allow-origin'):
+ origins = conf.return_values('cors allow-origin')
+ http_api['cors']['origins'] = origins[:]
+
if conf.exists('keys'):
for name in conf.list_nodes('keys id'):
if conf.exists('keys id {0} key'.format(name)):