python proxy to embed a google apps script service in an iframe

前端 未结 1 1667
渐次进展
渐次进展 2021-01-26 12:40

There\'s \"X-Frame-Options: SAMEORIGIN\" header preventing the Apps Script from rendering in a page not from sites.google.com (or docs.google.com)

相关标签:
1条回答
  • 2021-01-26 13:33

    The bs2grproxy works with a few small changes. I posted the solution here: http://code.google.com/p/google-apps-script-issues/issues/detail?id=546#c104

    The changes:

    In file bs2grproxy.py below line 48, "raise Exception('Unsupported ..." insert:

            scm = 'https'
    

    below line 134, "raise Exception('Requested ..." insert:

                if fetched:
                    if resp.headers.get('Content-Type', '').find('html') >= 0:
                        resp.content = resp.content + '<style type="text/css"> .warning-panel {display: none;} </style>'
                        resp.headers['x-frame-options'] = 'IGNORE'
                        logging.info("warning-panel hidden and x-frame-options reset")
    

    You may also need to change the proxy time out in bs2grproxy.py, like this:

    resp = urlfetch.fetch(new_path, self.request.body, method, newHeaders, False, False, 30)
    

    Eddy.

    0 讨论(0)
提交回复
热议问题