summaryrefslogtreecommitdiff
path: root/src/conf_mode/http-api.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2021-12-16 08:32:23 -0600
committerJohn Estabrook <jestabro@vyos.io>2021-12-16 12:12:54 -0600
commite671c4b33157836e73a3efc91e691215bc5b144b (patch)
tree974fbd759e67a1dafac2785f7466880a1b1bfe80 /src/conf_mode/http-api.py
parent98396247fcba8b7793e62c483288fdda34c77f3c (diff)
downloadvyos-1x-e671c4b33157836e73a3efc91e691215bc5b144b.tar.gz
vyos-1x-e671c4b33157836e73a3efc91e691215bc5b144b.zip
http-api: T4076: allow setting CORS option 'Access-Control-Allow-Origin'
(cherry picked from commit 55f8ede2d09a9ad095f9ec5c2a729f8c5fb6aafa)
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)):