Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Metabase
  3. Metabase CORS and CSP headers

Metabase CORS and CSP headers

Scheduled Pinned Locked Moved Solved Metabase
20 Posts 2 Posters 3.6k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    staypath
    wrote on last edited by
    #10

    If adding user.conf customization would persist settings like headers in nginx, that might be a good feature. Thanks again.

    girishG 1 Reply Last reply
    0
    • S staypath

      If adding user.conf customization would persist settings like headers in nginx, that might be a good feature. Thanks again.

      girishG Offline
      girishG Offline
      girish
      Staff
      wrote on last edited by girish
      #11

      @staypath was discussing this internally and we got a bit confused by your earlier comment in #3 . Do you know how/why adding CORS fixed your embedding issue.

      Isn't embedding mattermost metabase about adding an IFRAME? If so, this only involves fixing the CSP header and the CORS headers should have no relevance. Did we misunderstand something ? CORS is only applicable if a website frontend, which is not mattermost metabase, is making API calls to mattermost metabase.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        staypath
        wrote on last edited by
        #12

        Thanks for the reply. We are embedding Metabase, not Mattermost. I agree with you, normally CORS would not apply, but as I mentioned previously, we are embedding Metabase within a Retool iFrame component. Something about how Retool fetches the iFrame content is making it appear to the browser that it should check for CORS headers. Since CORS headers don't exist, the browser refuses to load the iFrame. I think there are two questions here:

        1. is CORS even required in this scenario? Maybe it shouldn't be by design, but the Retool iFrame component will not load the Metabase content without CORS headers in place
        2. in edge cases like this, would the ability to customize nginx headers in Cloudron user.conf solve the issue?

        Thanks

        girishG 1 Reply Last reply
        0
        • S staypath

          Thanks for the reply. We are embedding Metabase, not Mattermost. I agree with you, normally CORS would not apply, but as I mentioned previously, we are embedding Metabase within a Retool iFrame component. Something about how Retool fetches the iFrame content is making it appear to the browser that it should check for CORS headers. Since CORS headers don't exist, the browser refuses to load the iFrame. I think there are two questions here:

          1. is CORS even required in this scenario? Maybe it shouldn't be by design, but the Retool iFrame component will not load the Metabase content without CORS headers in place
          2. in edge cases like this, would the ability to customize nginx headers in Cloudron user.conf solve the issue?

          Thanks

          girishG Offline
          girishG Offline
          girish
          Staff
          wrote on last edited by
          #13

          @staypath whooops sorry, that was an unintentionaly typo. I meant metabase all along. As for retool, I am just looking at what that is.

          1 Reply Last reply
          0
          • girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by
            #14

            A simple iframe test works for me in Surfer:

                <!DOCTYPE html>    
                <html>    
                <body>    
                <h2>HTML Iframes example</h2>    
                <p>Use the height and width attributes to specify the size of the iframe:</p>    
                <iframe src="https://metabase.smartserver.io/public/dashboard/5124c74d-ab16-42d7-b1a1-68b774e5dd66" height="500" width="500"></iframe>    
                </body>    
                </html>  
            

            image.png

            Not sure what retool is doing.

            1 Reply Last reply
            0
            • girishG Offline
              girishG Offline
              girish
              Staff
              wrote on last edited by
              #15

              OK, found the problem . @staypath retool is removing the allow-same-origin from the iframe . See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#allow-same-origin . This makes API calls in the IFRAME appear as cross origin. Adding it manually in web inspector, makes retool show it:

              image.png

              1 Reply Last reply
              0
              • girishG Offline
                girishG Offline
                girish
                Staff
                wrote on last edited by
                #16

                Ah, found it. Just check this option in retool (Interaction -> Enable Storage and cookies) and it works.

                image.png

                1 Reply Last reply
                0
                • girishG girish marked this topic as a question on
                • girishG girish has marked this topic as solved on
                • S Offline
                  S Offline
                  staypath
                  wrote on last edited by
                  #17

                  I really appreciate you looking into this. You have gone above and beyond, so thank you again. I saw the Storage and Cookies option in the Retool docs as well, and strangely, my Retool instance does not have this option. I will open a support ticket with Retool to figure out why this option is missing. Thank you again for the help with troubleshooting.
                  CleanShot 2024-04-06 at 07.06.44@2x.png

                  1 Reply Last reply
                  0
                  • girishG Offline
                    girishG Offline
                    girish
                    Staff
                    wrote on last edited by
                    #18

                    @staypath ah interesting. I am using the cloud version. Maybe you are on selfhosted?

                    S 1 Reply Last reply
                    0
                    • girishG girish

                      @staypath ah interesting. I am using the cloud version. Maybe you are on selfhosted?

                      S Offline
                      S Offline
                      staypath
                      wrote on last edited by
                      #19

                      @girish Yes, maybe that is the difference. I am using self-hosted Retool.

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        staypath
                        wrote on last edited by
                        #20

                        @girish Just closing out this discussion. For reference, here is when the change was introduced to Retool that caused the issue with loading the iframe:

                        https://docs.retool.com/releases/legacy/3.22#:~:text=Disabled Storage and cookies

                        Thanks again.

                        1 Reply Last reply
                        1
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Bookmarks
                        • Search