Search code examples
asp.net-coreaspnetboilerplate

aspnetboilerplate: removing x-frame-options headers


enter image description here

in my aspnetboilerplate based site,
how do I remove X-Frame-Options: SAMEORIGIN header from asp.net core response.

what I have tried
1.

        string MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
        services.AddCors(options =>
        {
            options.AddPolicy(MyAllowSpecificOrigins,
            builder =>
            {
                builder.WithOrigins("http://www.example.org/",
                                    "https://www.example.org/");
            });
        });

 app.UseCors(MyAllowSpecificOrigins);
  1. also tried adding this in startup

    services.AddAntiforgery(x => x.SuppressXFrameOptionsHeader = true);

  2. adding in web.config <remove name="X-Frame-Options"/>


Solution

  • Initialize abp framework as follows:

            app.UseAbp(options =>
            {
                options.UseSecurityHeaders = false;
            }); // Initializes ABP framework.