-
-
Notifications
You must be signed in to change notification settings - Fork 712
fix: use listhen's publicUrl
if available
#3500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
Deploying content with Β
|
Latest commit: |
9463608
|
Status: | Β β Β Deploy successful! |
Preview URL: | https://5c4ecc2f.content-f0q.pages.dev |
Branch Preview URL: | https://fix-websocker-public-url.content-f0q.pages.dev |
Great work! I verified this works, you just have to specify |
@dargmuesli I think this PR also affect/help you, but it should not break the current behavior. |
@@ -36,7 +36,8 @@ export async function startSocketServer(nuxt: Nuxt, options: ModuleOptions, mani | |||
listener = await listen(() => 'Nuxt Content', websocketOptions) | |||
|
|||
// Register ws url | |||
;(nitro.options.runtimeConfig.public.content as Record<string, unknown>).wsUrl = listener.url.replace('http', 'ws') | |||
const publicConfig = nitro.options.runtimeConfig.public.content as Record<string, unknown> | |||
publicConfig.wsUrl = (websocketOptions.publicURL || listener.url).replace('http', 'ws') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
publicConfig.wsUrl = (websocketOptions.publicURL || process.env.publicURL || listener.url).replace('http', 'ws')
to use option --publicURL
defined by the nuxt dev
command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tries this?
Public URL of websocket and Nuxt are different, since the module creates its own server for websocket, using same publicURL will cause issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Itβs actually only the port that is different, not the public URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Itβs actually only the port that is different, not the public URL.
We are passing the whole url to client and we don't change the port. So sharing same url means calling to the same port.
We can do it by adding port to publicUrl in publicConfig.wsUrl = (websocketOptions.publicURL || listener.url).replace('http', 'ws')
but the end result will not be same.
Laravel Valet proxies allow binding a domain to a service running on a specific port, but they donβt support handling multiple services with different ports. Example:
Thatβs why Iβd rather keep using |
π Linked issue
β Type of change
π Description
π Checklist