]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mgr/dashboard: allow cross origin when the url is set 49151/head
authorNizamudeen A <nia@redhat.com>
Fri, 25 Nov 2022 14:53:31 +0000 (20:23 +0530)
committerNizamudeen A <nia@redhat.com>
Wed, 30 Nov 2022 06:23:17 +0000 (11:53 +0530)
commit028c8e22e36bcaee30481cf05a9ddeb1b339c26d
tree731ac0bfc57537c4a04b1cb897694293a208d7aa
parent5f6f3c43f01a8027d5d6c5bd5ed514901f9b6917
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