🔧 AI Nachrichten Debian is Voting on Whether to Allow AI-Assisted Contributions(23.08.2026 um 09:34 Uhr)
🔧 AI Nachrichten The Linux Kernel Is Approaching 2,000 CVEs Per Release(29.08.2026 um 20:00 Uhr)
⚠️ Malware / Trojaner / VirenCitrix Adds a Linux-Powered Escape Hatch For Compromised Windows PCs(30.08.2026 um 17:34 Uhr)
🔧 AI Nachrichten Debian is Voting on Whether to Allow AI-Assisted Contributions(23.08.2026 um 09:34 Uhr)
🔧 AI Nachrichten The Linux Kernel Is Approaching 2,000 CVEs Per Release(29.08.2026 um 20:00 Uhr)
⚠️ Malware / Trojaner / VirenCitrix Adds a Linux-Powered Escape Hatch For Compromised Windows PCs(30.08.2026 um 17:34 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 3 Min Lesezeit
0

[Vite + React] Running an ASP.NET Core application behind a reverse proxy

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




Intro



This time, I will try running my ASP.NET Core application behind reverse proxy.

On the client-side, I will use a React application generated by Vite.







The URL will be changed when I use a reverse proxy.

















How to access URL
Direct access http//localhost:5170
Using a reverse proxy





Problems



When I access the React application, the URL automatically changes from "".

However, after the change, four problems occurred.




  1. ERR_TOO_MANY_REDIRECTS

  2. Couldn't access ASP.NET Core Web API

  3. Route paths of react-router-dom

  4. Accessing ASP.NET Core Web API from the React application






Problem 1. ERR_TOO_MANY_REDIRECTS



When I tried to access "), it would be routed to the Vite-side and I would get a 404 error.

So I changed "UseSpa" would be executed only if the accessed URL does not contain "/api".






Program.cs






CODE
...
app.MapControllers();
app.MapWhen(context => context.Request.Path.StartsWithSegments("/api") == false,
b => {
b.UseSpa(spa =>
{
if (builder.Environment.EnvironmentName == "Development")
{
spa.Options.SourcePath = "office-file-accessor";
spa.UseProxyToSpaDevelopmentServer("http://localhost:5173");
}
else
{
spa.Options.SourcePath = "office-file-accessor/dist";
}
});
});
app.Run();
...













Problem 4. Accessing ASP.NET Core Web API from the React application



The ASP.NET Core Web API URLs what were accessed by the React application wouldn't be changed.

Because I couldn't find how to change the URLs automatically, so I decided to switch the URL depending on whether I was in the product environment or not.






serverUrlGetter.ts






CODE
export function getServerUrl() {
if(import.meta.env.MODE === "production") {
return "/officefiles";
}
return "";
}









IndexPage.tsx






CODE
import { useEffect } from "react"
import { getServerUrl } from "./web/serverUrlGetter";

export function IndexPage(): JSX.Element {
useEffect(() => {
fetch(`${getServerUrl()}/api/files`, {
mode: "cors",
method: "GET"
})
.then(res => res.text())
.then(res => console.log(res))
.catch(err => console.error(err));
}, []);


return <h1>Hello World!</h1>
}


Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Debian is Voting on Whether to Allow AI-Assisted Contributions
1 Quelle
The Linux Kernel Is Approaching 2,000 CVEs Per Release
1 Quelle
Citrix Adds a Linux-Powered Escape Hatch For Compromised Windows PCs
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten [Vite + React] Running an ASP.NET Core application behind a reverse proxy

Thematisch verwandte Begriffe: Vite, React, Running, ASPNET · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
📂 News ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

↗ Original-Quelle
Zum Aktualisieren ziehen
ZERO-DAY Kritische Sicherheitsmeldung
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
🤖
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen