Search code examples
node.jshttpsrequestwindows-firewall

Https GET request successful from browser but failing from node js server


My System is configured to have the Windows firewall which blocks the outbound connection and allow connection only through fiddler. In this scenario, when I am trying to send an Https GET request from a node js express server using https node module, it is failing. But when I try the same request from the browser it is successful. What might be the issue because of which it is failing?

And when I add a TCP port rule in windows firewall to allow 80 and 443 rule, the node js request also succeeds.


Solution

  • We need to add a rule in windows firewall outbound rules to allow the application to send a request.

    Steps to add the rule :

    1. Launch “Windows Defender Firewall”
    2. Go to “Advanced Settings”
    3. Select “Outbound Rules” and select “New Rule”
    4. Click “Next” and click on “browse” and select the application. In this case the “node” from nodejs folder.
    5. Click “Next” to go to action page.
    6. Choose “Allow the connection” radio button.
    7. Click “Next”
    8. Click “Next” again
    9. Specify some name in the “Name” field and click Finish.