]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mgr/dashboard: allow cross origin when the url is set
authorNizamudeen A <nia@redhat.com>
Fri, 25 Nov 2022 14:53:31 +0000 (20:23 +0530)
committerAvan Thakkar <athakkar@redhat.com>
Wed, 14 Dec 2022 13:56:30 +0000 (19:26 +0530)
commit4653cf3a089d4122cc2d54d222cd1a702129a45b
treecc9279f15fb9ceee8ecacce02a99862a8c6c02cf
parentf87280a7ef757aebe1842333fefb14f5a2e930d2
mgr/dashboard: allow cross origin when the url is set

Allow CORS when the cross_origin_url is set in the config opt.

you have to update the cross_origin_url setting with the url of the
requesting entity.

The request needs to have the header `Access-Control-Allow-Origin`
with the origin URL

The url can be set using this command
`ceph config set mgr mgr/dashboard/cross_origin_url
http://localhost:4200`

multiple urls can be set as
`ceph config set mgr mgr/dashboard/cross_origin_url
http://localhost:4200,http://localhost:4201`

If multiple url is provided in the configuration option, then whatever
url is there in the Access-Control-Allow-Origin request header will be
allowed for CORS

Once the URL is set you have to restart the dashboard module to restart
the cherrypy server with the new CORS policies

Fixes: https://tracker.ceph.com/issues/58086
Signed-off-by: Nizamudeen A <nia@redhat.com>
(cherry picked from commit 1cf017bde492d3058d05b4375c1168cec9002afd)
src/pybind/mgr/dashboard/module.py