File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,12 +20,18 @@ defmodule ShopifyAPI.Plugs.PutShopifyContentHeaders do
2020
2121 def call ( conn , _options ) do
2222 conn
23- |> put_resp_header ( "x-frame-options" , "ALLOW-FROM https:// " <> myshopify_domain ( conn ) )
23+ |> put_resp_header ( "x-frame-options" , "ALLOW-FROM " <> myshopify_domain_url ( conn ) )
2424 |> put_resp_header (
2525 "content-security-policy" ,
26- "frame-ancestors https:// " <> myshopify_domain ( conn ) <> " https://admin.shopify.com;"
26+ "frame-ancestors " <> myshopify_domain_url ( conn ) <> " https://admin.shopify.com;"
2727 )
2828 end
2929
30- defp myshopify_domain ( % { assigns: % { shop: % { domain: domain } } } ) , do: domain
30+ defp myshopify_domain_url ( conn ) do
31+ case conn do
32+ % { assigns: % { shop: % { domain: domain } } } -> "https://" <> domain
33+ % { params: % { "shop" => domain } } -> "https://" <> domain
34+ _ -> ""
35+ end
36+ end
3137end
You can’t perform that action at this time.
0 commit comments