Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 21, 2025

The blog maintained a permanent SignalR connection for every user via global InteractiveServer render mode, despite most pages being read-only. This consumed server resources unnecessarily and introduced a 1MB payload limit that expanded the DDoS attack surface.

Changes

Render Mode Configuration

  • Removed global @rendermode RenderMode.InteractiveServer from Routes.razor
  • Added @using static Microsoft.AspNetCore.Components.Web.RenderMode to _Imports.razor
  • Most pages now render as static SSR by default (Index, Archive, Search, AboutMe container)

Selective Interactivity

Added @rendermode InteractiveServer to 33 components requiring it:

Local Storage & Client State

  • BookmarkButton, Like, ThemeToggler - use ProtectedLocalStorage

Drag & Drop

  • SkillTable, Profile - HTML5 drag events with @ondrag/@ondrop

JS Interop

  • Giscus, Disqus, ReadingIndicator - third-party libraries via JSRuntime
  • CreateNewBlogPost - navigation confirmation dialog
  • ShowBlogPostPage - syntax highlighting
  • MarkdownTextArea - Blazorise editor

Modal Dialogs & Admin

  • All modal components (ModalDialog, ConfirmDialog, etc.)
  • Admin pages (Settings, Dashboard, ShortCodes, etc.) with interactive forms

SignalR Configuration

Removed custom SignalR configuration from ServiceExtensions.cs:

- services.AddSignalR(options =>
- {
-     options.MaximumReceiveMessageSize = 1024 * 1024;
- });

Interactive components now use default SignalR settings with smaller payloads.

Impact

  • Static SSR pages: no WebSocket connection overhead
  • Enhanced navigation works automatically for internal links
  • Reduced server resource usage per concurrent user
  • Smaller attack surface with default message size limits
Original prompt

This section details on the original issue you should resolve

<issue_title>Use Static Server Side Rendering as much as possible</issue_title>
<issue_description>The blog uses a permanent SignalR connection between the client and the blog itself.
In many cases we don't need this as the blog is read-only and doesn't allow much modifications. Therefore static server side rendering might be better here.

For example:
The Index.razor navigation can be done via enhanced navigation (see: https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/routing?view=aspnetcore-10.0).

Also when creating a blog post or updating we can utilize enhanced forms (via the enhance form).
This would apply to many other areas like:

  • Creating a skill
  • Shortcodes
  • Skills in "About Me"

Question is if things like "drag and drop" of skills are working. And if the bookmark button is still working (also given that we have local storage things).
In any case, we can also remove the following code, if we do the form part:

services.AddSignalR(options =>
{
    options.MaximumReceiveMessageSize = 1024 * 1024;
});

Given that the expected payload is way less (and therefore less area of a DDoS attack).</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Refactor blog for static server side rendering Convert to static SSR with selective interactive components Nov 21, 2025
Copilot AI requested a review from linkdotnet November 21, 2025 20:34
@linkdotnet linkdotnet closed this Nov 21, 2025
@linkdotnet linkdotnet deleted the copilot/use-static-server-side-rendering branch November 23, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use Static Server Side Rendering as much as possible

2 participants