Created by: chybisov
We should always pass path parameter to app.use
and context parameter to proxy
, which are almost always the same, except cases mentioned in third Note.
app.use
mounts the specified middleware function at the specified path: the middleware function is executed when the base of the requested path matches path.
proxy
first parameter specify context (part of url) which then will be checked whether request url has it or not. This is not necessarily with http requests, but will break WebpackDevServer
sockjs-node
HMR functionality when we try to proxy some of our own websocket requests. Default context is '/'
and because all urls has '/'
, /sockjs-node
from WDS
also will be proxied, but it shouldn't. http requests work without specifying context because no one else sends http requests.
Related to this comment.