-
-
Notifications
You must be signed in to change notification settings - Fork 3
Comments
added host option to plugin config, fixed devServer value in nette.json#2
added host option to plugin config, fixed devServer value in nette.json #2jeremy-step wants to merge 8 commits intonette:master from
Conversation
jeremy-step
commented
Jun 25, 2025
I probably should have included a test to make sure the plugin option overrides the vite host config. Will add it later today.
jeremy-step
commented
Jun 25, 2025
Should be ready to go.
When I was writing the Docker Dev section in the docs, I noticed that there is a bug with the host also being set to true in the autogenerated CORS config. Will fix it later today.
Edit: Done, also added auto configuration of the allowedHosts option, needed for Vite to work properly.
MaN0fy
commented
Jul 10, 2025
Hi, thank you for your work. This works great for fixing the host issue.
However I ran into a case where I’d need the generated dev server URL to omit the port (i.e. just vite.localhost instead of vite.localhost:5173).
Would you consider adding a port option to the config (e.g. port: false, port: 80, port: 5173, etc.) to support that?
Could be helpful for setups with reverse proxies.
Thanks!
jeremy-step
commented
Jul 10, 2025
Hi, yeah, should be an easy fix. Will look into it later when I have a bit more time. In the meantime you could add a patch to the vite plugin yourself. There is a npm package (patch-package) for these situations that allows you to modify a package until whatever feature you need is released.
jeremy-step
commented
Jul 10, 2025
Should work now. The generated devServer url with the following example config would be http://vite.localhost.
While the plugin does a lot of the work for you when it comes to configuring CORS and Allowed Hosts, it doesn't account for a lot of cases that might need more complex configuration. Depending on your needs, you might need to configure that stuff yourself.
export default defineConfig({ plugins: [ nette({ host: "vite.localhost", }), ], server: { host: true, // Or '0.0.0.0' port: 80, strictPort: true, }, ... });
sazmajaroslav
commented
Jan 5, 2026
Thanks for the plugin and this modification. Please merge the modification and release a new version of the package?
hanisko
commented
Jan 22, 2026
Could you please address this pull request? I have also encountered the same issue.
Uh oh!
There was an error while loading. Please reload this page.
http://true:5173#1This PR adds a new host option to the plugin configuration. This allows to override the vite host config when needed.
Additionally, if the host value is set to
trueor'0.0.0.0', it is replaced with'localhost', fixing incorrect urls in the generated nette.json file.While
http://0.0.0.0:5173does work, it redirects tohttp://localhost:5173for each asset loaded.For example:
will result in: