Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I have some JavaScript that needs to have access to external json. How do I configure my site to allow this?
I've added a little bit of middleware so I can add custom headers.
for example: startup.cs
app.UseMiddleware<CustomHeaders>(); app.UseUmbraco() ......
CustomHeaders.cs
public class CustomHeaders{ private readonly RequestDelegate _next; public CustomHeaders(RequestDelegate next) { _next = next; } public async Task InvokeAsync(HttpContext context) { context.Response.Headers.Add("X-Frame-Options", "sameorigin"); context.Response.Headers.Add("X-Xss-Protection", "1; mode=block"); context.Response.Headers.Add("X-Content-Type-Options", "nosniff"); await _next(context); }}
You could add your Access-Control-Allow-Origin in a similar way.
That is a very nice dolution Ambert.
This actually answered a bit of my questions. Is this compiled into the "projectName.dll" ?
Yes it is :-)
I have followed this but can't see the headers and health check still reports these, any ideas what I might be missing ?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
How to add header with "Access-Control-Allow-Origin: *" in Umbraco 9?
Hi,
I have some JavaScript that needs to have access to external json. How do I configure my site to allow this?
I've added a little bit of middleware so I can add custom headers.
for example: startup.cs
CustomHeaders.cs
You could add your Access-Control-Allow-Origin in a similar way.
That is a very nice dolution Ambert.
This actually answered a bit of my questions. Is this compiled into the "projectName.dll" ?
Yes it is :-)
I have followed this but can't see the headers and health check still reports these, any ideas what I might be missing ?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.