Skip to content

Commit ae11f69

Browse files
authored
Streaming SSR: Fix RWJS_EXP_SSR_GRAPHQL_ENDPOINT logic (#9134)
Prefer `RWJS_EXP_SSR_GRAPHQL_ENDPOINT` if it's set. Fallback to `proxiedApiUrl` if not.
1 parent 0ff463f commit ae11f69

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/vite/src/streaming/registerGlobals.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export const registerFwGlobals = () => {
3434
return apiPath
3535
} else {
3636
const proxiedApiUrl =
37+
// NOTE: rwConfig.web.host defaults to "localhost", which is
38+
// troublesome in regards to IPv6/IPv4. So all the more
39+
// reason to set RWJS_EXP_SSR_GRAPHQL_ENDPOINT
3740
'http://' + rwConfig.web.host + ':' + rwConfig.web.port + apiPath
3841

3942
if (
@@ -52,7 +55,7 @@ export const registerFwGlobals = () => {
5255
console.warn()
5356

5457
console.warn(
55-
'You can override this for by setting RWJS_EXP_SSR_GRAPHQL_ENDPOINT in your environment vars'
58+
'You can override this for SSR by setting RWJS_EXP_SSR_GRAPHQL_ENDPOINT in your environment vars'
5659
)
5760
console.warn()
5861

@@ -62,7 +65,7 @@ export const registerFwGlobals = () => {
6265
}
6366

6467
return (
65-
proxiedApiUrl || (process.env.RWJS_EXP_SSR_GRAPHQL_ENDPOINT as string)
68+
(process.env.RWJS_EXP_SSR_GRAPHQL_ENDPOINT as string) ?? proxiedApiUrl
6669
)
6770
}
6871
})(),

0 commit comments

Comments
 (0)