Merge branch 'master' into sa-graphql-token-transfers-query-2

pull/1176/head
Andrew Cravenho 6 years ago committed by GitHub
commit 37062d31f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      apps/block_scout_web/lib/block_scout_web/plug/allow_iframe.ex
  2. 6
      apps/block_scout_web/lib/block_scout_web/router.ex
  3. 0
      apps/block_scout_web/test/block_scout_web/controllers/tokens/inventory_controller_test.exs

@ -0,0 +1,14 @@
defmodule BlockScoutWeb.Plug.AllowIframe do
@moduledoc """
Allows for iframes by deleting the
[`X-Frame-Options` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options)
"""
alias Plug.Conn
def init(opts), do: opts
def call(conn, _opts) do
Conn.delete_resp_header(conn, "x-frame-options")
end
end

@ -55,8 +55,14 @@ defmodule BlockScoutWeb.Router do
max_complexity: @max_complexity
)
# Disallows Iframes (write routes)
scope "/", BlockScoutWeb do
pipe_through(:browser)
end
# Allows Iframes (read-only routes)
scope "/", BlockScoutWeb do
pipe_through([:browser, BlockScoutWeb.Plug.AllowIframe])
resources("/", ChainController, only: [:show], singleton: true, as: :chain)

Loading…
Cancel
Save