Feature Request: Allow Custom Server Config with Proxy Middleware Support in Static File Server Executor #31143
Squixx
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Feature Request: Allow Custom Server Config with Proxy Middleware Support in Static File Server Executor
Description
It would be very useful if the Nx static file server executor (
file-server.impl.ts
) supported an option to provide a custom server configuration file. This would allow users to set up their own server logic, including advanced proxying via middleware such ascreateProxyMiddleware
, similar to what the Angular dev server supports.Motivation and Use Case
Currently, the static file server only supports basic proxying via CLI options. In more complex scenarios—such as when you need to rewrite paths, add authentication, or handle advanced proxy logic—this is not sufficient. The Angular dev server allows users to provide a
proxy.conf.json
or custom middleware for flexible proxying. Bringing similar extensibility to the Nx static file server would enable more advanced and production-like local development setups.Additionally, this feature would improve Nx Atomizer performance. It would allow for using static builds in scenarios where the Angular dev server is currently used only for its proxying capabilities. By enabling static file serving with custom proxy middleware, Atomizer can leverage faster static builds instead of relying on the Angular dev server as a proxy, resulting in improved speed and efficiency for affected workflows.
Proposed Solution
serverConfig
orcustomServerPath
) to the executor schema.createProxyMiddleware
.Example Use Case
A user wants to proxy
/api
requests to a backend server with custom headers and path rewrites, while serving static files for the rest. With this feature, they could provide a custom server file that usescreateProxyMiddleware
for/api
and serves static files otherwise.Benefits
Additional Context
I am willing to implement this feature, but I would like to know if this is something that would be wanted before starting work.
See the current implementation in
file-server.impl.ts
for reference.Beta Was this translation helpful? Give feedback.
All reactions