Overcoming “Display forbidden by X-Frame-Options”

后端 未结 26 2313
梦谈多话
梦谈多话 2020-11-21 06:31

I\'m writing a tiny webpage whose purpose is to frame a few other pages, simply to consolidate them into a single browser window for ease of viewing. A few of the pages I\'

26条回答
  •  梦谈多话
    2020-11-21 07:19

    The only real answer, if you don't control the headers on your source you want in your iframe, is to proxy it. Have a server act as a client, receive the source, strip the problematic headers, add CORS if needed, and then ping your own server.

    There is one other answer explaining how to write such a proxy. It isn't difficult, but I was sure someone had to have done this before. It was just difficult to find it, for some reason.

    I finally did find some sources:

    https://github.com/Rob--W/cors-anywhere/#documentation

    ^ preferred. If you need rare usage, I think you can just use his heroku app. Otherwise, it's code to run it yourself on your own server. Note sure what the limits are.

    whateverorigin.org

    ^ second choice, but quite old. supposedly newer choice in python: https://github.com/Eiledon/alloworigin

    then there's the third choice:

    http://anyorigin.com/

    Which seems to allow a little free usage, but will put you on a public shame list if you don't pay and use some unspecified amount, which you can only be removed from if you pay the fee...

提交回复
热议问题