Join our Newsletter — 33% off our NHI Course
Home› Glossary› Architecture & Implementation› getServerSideProps
Architecture & Implementation

getServerSideProps

← Back to Glossary
By NHI Mgmt Group Updated November 2, 2026 Domain: Architecture & Implementation

getServerSideProps is a Next.js data fetching function that runs on every request to prepare props for a page on the server. It is used when the content must be current per request, because the HTML is generated dynamically rather than from a prebuilt static page.

What getServerSideProps Does

getServerSideProps is a Next.js server-side data fetching hook that runs on every request, then returns props for the page before HTML is sent to the browser. That makes it useful when the page must reflect fresh, request-specific data rather than a prebuilt snapshot.

Because the logic executes on the server for each visit, it sits closer to the application backend than static rendering does. That changes how teams think about performance, caching, data access, and the security of the code path that prepares page content.

When Server-Side Rendering Is the Right Choice

This pattern is best suited to content that changes too often, depends on request context, or must be computed from data that cannot be safely embedded at build time. Common examples include authenticated dashboards, per-user recommendations, locale-aware pages, or pages whose content depends on query parameters and backend state.

It also gives developers a simple way to keep page output aligned with current data sources without forcing client-side fetches after render. The trade-off is that every request now depends on live server work, which can increase latency and make backend dependencies part of the page delivery path.

How It Fits Into the Next.js Rendering Model

getServerSideProps is one of the main tools in the Next.js rendering model, alongside static generation and client-side data fetching. The key distinction is timing: static pages are prepared ahead of time, while server-side props are prepared during the request.

That difference affects cacheability and operational cost. A server-rendered page can be easier to keep accurate, but it can also be harder to scale if the page depends on slow APIs, expensive database queries, or logic that runs on every hit.

Security and Operational Implications

Any code that runs per request becomes part of the application’s trusted server path, so input handling, backend access, and secret usage matter more than they do in purely static pages. If the props function reaches internal APIs or databases, it can expose sensitive data, amplify performance problems, or create inconsistent responses when upstream systems fail.

Teams also need to treat request-driven rendering as an availability concern, because a slow or brittle data source can delay page delivery for all users. Misplaced assumptions about what should be fetched on the server can turn a convenience feature into a bottleneck.

Risk and Threat Considerations

Server-side data fetching increases the impact of backend failures, data leakage, and injection flaws because the page depends on live server execution for every request. It is especially sensitive when the page logic reads secrets, performs authorization checks, or consumes multiple upstream services.

Failure mechanism: Untrusted request data, weak backend validation, or an over-permissive data source can influence the server-rendered response, exposing information or creating server-side abuse conditions.

Impact: The result can be broken access boundaries, sensitive-data exposure, cache-poisoning style inconsistencies, or widespread availability issues if the rendering path becomes slow or unstable.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST CSF 2.0, NIST SP 800-53 Rev 5 and OWASP ASVS set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST CSF 2.0PR.AA-05 — Identity Management, Authentication and Access ControlServer-side page data often depends on authenticated request context.
DE.CM-01 — Networks and network services are monitored to find potential cybersecurity eventsPer-request rendering dependencies should be monitored for failures and anomalous access patterns.
Recommendation — Enforce least-privilege access for the data sources used by server-rendered pages. Monitor server-rendering dependencies for latency spikes, errors, and unusual request-driven behaviour.
NIST SP 800-53 Rev 5AC-6 — Least PrivilegeServer-rendered pages should only access the data and services they need.
SI-10 — Information Input ValidationRequest-derived parameters can shape server-side rendering logic and outputs.
Recommendation — Restrict server-side page code to the minimum permissions needed for each request. Validate all request inputs before using them in server-side data fetches or page assembly.
OWASP ASVSV15 — Secure Coding and ArchitectureServer-side rendering choices affect application design, trust boundaries, and data flow.
Recommendation — Design server-side props logic to keep trust boundaries narrow and backend dependencies explicit.

Practitioner Guidance

Why practitioners should care: getServerSideProps should be reserved for pages that genuinely need per-request freshness, not as a default replacement for static rendering. The more logic you place there, the more your page delivery depends on backend correctness and latency.

What to watch for: Review what data the function touches, how it handles failures, and whether the same outcome could be delivered more safely with caching, static generation, or client-side fetching. Keep the request path narrow and predictable, especially when the page is user-specific or data-sensitive.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 2, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org