Consider making target optional
See original GitHub issueIs this a feature request?
Yes
For some routes, I just want them to return a 404, and I don’t want to proxy them anywhere. I’m able to accomplish this using onProxyReq
like so:
proxy('/route', {
target: 'https://localhost/', // target is ignored since we always send 404s
onProxyReq: (proxyReq, req, res) => { res.status(404).send(); }
}));
For these routes, the target
really is irrelevant - there’s no place I’m trying to proxy them to. But, I have to include a target
in the config, or else I’ll get the following error:
[HPM] Missing "target" option. Example: {target: "http://www.example.org"}
Maybe target
should be optional, and the message above could be a warning instead of an error.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Source Optional vs Target Optional - Oracle Communities
If I am looking at one woman, it is indeed optional as to whether or not that woman has children. Children (target) are...
Read more >"Optional" object file target in Makefile? - c++ - Stack Overflow
How do I properly create a Makefile that excludes it as a dependency if there is an error when creating the object file?...
Read more >Source & Target optional - Codebots
An explanation of the source optional and target optional switches used in the properties panel of the Entity Diagram.
Read more >Special Targets (GNU make)
PHONY are considered to be phony targets. When it is time to consider such a target, make will run its recipe unconditionally, regardless...
Read more >Customizing the build phases of a target - Apple Developer
You can also examine the build phases to diagnose potential issues. ... The order of the targets indicates the order in which Xcode...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
its still relevant when using custom router… in this case no need “target”
@chimurai could we maybe reconsider making target optional? Just stumbled upon this when using the router option to dynamically determine the target.