Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/galamai/AspNetCore.Rendertron
ASP.net core middleware for GoogleChrome Rendertron https://github.com/GoogleChrome/rendertron.
https://github.com/galamai/AspNetCore.Rendertron
Last synced: 7 days ago
JSON representation
ASP.net core middleware for GoogleChrome Rendertron https://github.com/GoogleChrome/rendertron.
- Host: GitHub
- URL: https://github.com/galamai/AspNetCore.Rendertron
- Owner: galamai
- License: mit
- Created: 2017-11-12T20:10:33.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-05-22T07:34:48.000Z (over 2 years ago)
- Last Synced: 2024-10-14T00:19:47.505Z (about 1 month ago)
- Language: C#
- Homepage:
- Size: 153 KB
- Stars: 31
- Watchers: 6
- Forks: 9
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AspNetCore.Rendertron
ASP.net core middleware for GoogleChrome Rendertron [https://github.com/GoogleChrome/rendertron](https://github.com/GoogleChrome/rendertron).## NuGet
`Install-Package Galamai.AspNetCore.Rendertron`## Use
In `Startup.cs`Configure rendertron services
public void ConfigureServices(IServiceCollection services)
{
// Add rendertron services
services.AddRendertron(options =>
{
// rendertron service url
options.RendertronUrl = "http://rendertron:3000/render/";// proxy url for application
options.AppProxyUrl = "http://webapplication";// prerender for firefox
//options.UserAgents.Add("firefox");// inject shady dom
options.InjectShadyDom = true;
// use http compression
options.AcceptCompression = true;
});
}
orpublic void ConfigureServices(IServiceCollection services)
{
// Add rendertron services
services.AddRendertron(rendertronUrl: "http://rendertron:3000/render/");
}
Configure middlewarepublic void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
...
// Use Rendertron middleware
app.UseRendertron();
...
app.UseMvc();
}## Services configuration
| Property | Default | Description |
| -------- | ------- | ----------- |
| `AcceptCompression` | `false` | Add http compression suppor for Rendertron proxy client. |
| `RendertronUrl` | *Required* | URL of your running Rendertron service. |
| `UserAgents` | A set of known bots that benefit from pre-rendering. ("W3C_Validator", "baiduspider", "bingbot", "embedly", "facebookexternalhit", "linkedinbo", "outbrain", "pinterest", "quora link preview", "rogerbo", "showyoubot", "slackbot", "twitterbot", "vkShare") | Part of requests by User-Agent header. |
| `InjectShadyDom` | `false` | Force the web components polyfills to be loaded. [Read more.](https://github.com/GoogleChrome/rendertron#web-components) |
| `Timeout` | `TimeSpan.FromSeconds(10)` | Millisecond timeout for the proxy request to Rendertron. If exceeded, the standard response is served (i.e. `next()` is called). See also the [Rendertron timeout.](https://github.com/GoogleChrome/rendertron#rendering-budget-timeout) |
| `AppProxyUrl` | `null` | Use proxy before application. |
| `HttpCacheMaxAge` | `TimeSpan.Zero` | Set responce cache max age. |