Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

help: Skip redirect for non-document requests in dev server.

Shubham Padia2c40b6168a5a
diff --git a/starlight_help/astro.config.mjs b/starlight_help/astro.config.mjs
index f76b9d782cf..365d72a2ab7 100644
--- a/starlight_help/astro.config.mjs
+++ b/starlight_help/astro.config.mjs
@@ -52,7 +52,13 @@ function createRedirectPlugin() {
// the web app. We have relative URLs pointing to the web app
// in the help center, but they are not on the port help center
// is running on. We redirect here to our web app proxy port.
- if (req.url && !req.url.startsWith("/help")) {
+ // We skip redirect for non-document requests since astro assets
+ // don't have the /help prefix.
+ if (
+ req.url &&
+ !req.url.startsWith("/help") &&
+ req.headers.accept?.includes("text/html")
+ ) {
const host = req.headers.host || "localhost";
const redirectUrl = new URL(req.url, `http://${host}`);
// We run help center on the proxy port in case of