question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider making target optional

See original GitHub issue

Is 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:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
LiranBricommented, Nov 25, 2019

its still relevant when using custom router… in this case no need “target”

2reactions
fbo3264commented, Dec 22, 2020

@chimurai could we maybe reconsider making target optional? Just stumbled upon this when using the router option to dynamically determine the target.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found