Skip to content

Commit 20d47cb

Browse files
committed
map 404 to Node
1 parent 2ba9c16 commit 20d47cb

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

TechStacks/Program.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,18 @@
107107
});
108108

109109
var app = builder.Build();
110+
110111
// Proxy 404s to Next.js (except for API/backend routes) must be registered before endpoints
111112
var nodeProxy = new NodeProxy("http://localhost:3000") {
112113
Log = app.Logger
113114
};
114-
115-
app.UseForwardedHeaders();
115+
app.MapNotFoundToNode(nodeProxy);
116116

117117
// Configure the HTTP request pipeline.
118118
if (app.Environment.IsDevelopment())
119119
{
120120
app.UseDeveloperExceptionPage();
121121
app.UseMigrationsEndPoint();
122-
123-
app.MapNotFoundToNode(nodeProxy);
124122
}
125123
else
126124
{
@@ -129,6 +127,7 @@
129127
app.UseHsts();
130128
}
131129

130+
app.UseForwardedHeaders();
132131
app.UseDefaultFiles();
133132
app.UseStaticFiles();
134133
app.MapCleanUrls();

0 commit comments

Comments
 (0)