Basic url works fine in browser not in node-red HTTP request

Hi there,

I'm trying to access Sydney airport json data at:

http://www.bom.gov.au/fwo/IDN60801/IDN60801.94767.json

When I navigate there in chrome, it works fine and I get a page full of JSON data. When I access it from the node-red standard html request node (using GET method and returning parsed JSON), a I get this response:

<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>
 
You don't have permission to access "http&#58;&#47;&#47;www&#46;bom&#46;gov&#46;au&#47;fwo&#47;IDN60801&#47;IDN60801&#46;94767&#46;json" on this server.<P>
Reference&#32;&#35;18&#46;15052017&#46;1586177669&#46;37d153b7
</BODY>
</HTML>

Any ideas?

The page expects a user-agent header.

Try it like this:

[{"id":"3e7da731.d3de9","type":"inject","z":"bd9167ef.aa93c8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":276,"y":408,"wires":[["621552b0.4a6e9c"]]},{"id":"2eee3e90.ae1dda","type":"http request","z":"bd9167ef.aa93c8","name":"","method":"GET","ret":"obj","paytoqs":false,"url":"http://www.bom.gov.au/fwo/IDN60801/IDN60801.94767.json","tls":"","persist":false,"proxy":"","authType":"","x":574,"y":408,"wires":[["1d82389c.0ee617"]]},{"id":"1d82389c.0ee617","type":"debug","z":"bd9167ef.aa93c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":742,"y":408,"wires":[]},{"id":"621552b0.4a6e9c","type":"function","z":"bd9167ef.aa93c8","name":"","func":"msg.headers = {};\nmsg.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15';\nreturn msg;\n\n\n","outputs":1,"noerr":0,"x":410,"y":408,"wires":[["2eee3e90.ae1dda"]]}]
3 Likes

Ahhh, thanks so much backman2, that' was the problem and I would have never figured it out on my own.

Cheers

Rob

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.