Skip to content

Commit

Permalink
Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jevgenijsp committed Nov 26, 2024
1 parent a5e8e7f commit 50e1310
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ By default, requests to files with the following extensions will be ignored by t

If you want to specify this yourself, add `IgnoredResourceExtensions` to the configuration.

### Specifying ignored URLs

If certain URLs should be ignored, you can use the `IgnoreSuggestionsUrlRegexPattern` option:

```
services.AddNotFoundHandler(o =>
{
o.IgnoreSuggestionsUrlRegexPattern = @"^(https?:\/\/[^\/]+)?\/(api|episerverapi|globalassets|siteassets)";
// The first group in this pattern is common if LogWithHostname is set to true
});
```

When a URL matches the specified regex pattern, suggestions will be skipped.


## Restricting access to the Admin UI

By default, only users of `Administrators` role can access Admin UI. But you can configure you authorization policy when registrating the NotFound handler.
Expand Down
2 changes: 1 addition & 1 deletion tests/Geta.NotFoundHandler.Tests/RequestHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class RequestHandlerTests
private static readonly Uri DefaultOldUri = new Uri("http://example.com/old");
private readonly NotFoundHandlerOptions _configuration;

private const string IgnoreSuggestionsUrlRegexPattern = "^(https?:\\/\\/[^\\/]+)?\\/(api|nilleapi|episerverapi|globalassets|siteassets)(?!\\/private)(\\/.*)?$";
private const string IgnoreSuggestionsUrlRegexPattern = @"^(https?:\/\/[^\/]+)?\/(api|nilleapi|episerverapi|globalassets|siteassets)(?!\/private)(\/.*)?$";

public RequestHandlerTests()
{
Expand Down

0 comments on commit 50e1310

Please sign in to comment.