# How can I internet accces via proxy with node-red on Ubuntu

**URL:** https://discourse.nodered.org/t/how-can-i-internet-accces-via-proxy-with-node-red-on-ubuntu/5742
**Category:** General
**Created:** [13 December 2018 02:43 UTC](https://discourse.nodered.org/t/how-can-i-internet-accces-via-proxy-with-node-red-on-ubuntu/5742 "2018-12-13T02:43:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![K\_ueda](https://avatars.discourse-cdn.com/v4/letter/k/d6d6ee/32.png) [@K\_ueda](https://discourse.nodered.org/u/K_ueda)
#### Post date: [13 December 2018 02:43 UTC](https://discourse.nodered.org/t/how-can-i-internet-accces-via-proxy-with-node-red-on-ubuntu/5742/1 "2018-12-13T02:43:45Z")

</div>

**【environment】**  
CentOS7(Linux 3.10.0-826.11.6.el7.x86\_64 x64 LE)  
Node-RED version: v0.18.7  
Node.js version:v6.14.3

**setting**  
【Proxy】  
telnet myproxy.local.co.jp 8080 and confirmed it  
GET [Yahoo! JAPAN](http://yahoo.co.jp/HTTP/1.1)  
I got HTM file

【OS】  
I wrote /etc/environmen

I wrote /etc/systemd/system/node-red.service

Environment="http\_proxy=[http://myproxy.local.co.jp:8080](http://myproxy.local.co.jp:8080)"  
Environment="https\_proxy=[http://myproxy.local.co.jp:8080](http://myproxy.local.co.jp:8080)"  
Environment="HTTP\_PROXY=[http://myproxy.local.co.jp:8080](http://myproxy.local.co.jp:8080)"  
Environment=HTTPS\_PROXY="[http://myproxy.local.co.jp:8080](http://myproxy.local.co.jp:8080)"

> Blockquote

---

<div class="post-metadata">

### Author: ![K\_ueda](https://avatars.discourse-cdn.com/v4/letter/k/d6d6ee/32.png) [@K\_ueda](https://discourse.nodered.org/u/K_ueda)
#### Post date: [13 December 2018 03:10 UTC](https://discourse.nodered.org/t/how-can-i-internet-accces-via-proxy-with-node-red-on-ubuntu/5742/2 "2018-12-13T03:10:21Z")

</div>

**Is there some wat to solve the error below**

**test1**  
connected "timestanp" and "http request" and "msg.payload" on the flow editor  
and click button timestanp and got the output

2018.12.4. 11:04:48 node:c7730383.291e7  
msg:error  
"AssertionError:protokol mismatch"

**test2**  
Set proxy to npm  
After executing npm init at ~ / .node-red /, npm install was done  
~ /. .node-red / node\_modules is created, the request directory is created  
I confirmed that request.js has been created

After adding the following to setting.js

【coding】

code  
functionGlobalContxt: {  
request: require (`/root/.node\_modules/request/request.js'),  
},

After typing systemctl restart node-red.service  
I confirmed that the node-red flow editor can be displayed in the browser

Manually inject messages into flow timestamp node to function node  
Connected and named proxy-use and described below

【code】  
var request = context.grobal.request;  
request ({'url': '[https://www.google.com/](https://www.google.com/)', 'proxy''[http://myproxy.local.co.jp:8080/](http://myproxy.local.co.jp:8080/)', function (error, response, body) {  
if (! error && response.statusCode == 200) {  
console.log (body);  
}  
});

【error】  
When msg.payload was connected to the above function node and deployed, no error occurred

However, when injecting messages from timstanp, the following error occurs

2018/12/11 16:15:02 node: proxy-use  
function: (error)  
"TypeError: Can not set property  
'domain' of undefined '

---

<div class="post-metadata">

### Author: ![K\_ueda](https://avatars.discourse-cdn.com/v4/letter/k/d6d6ee/32.png) [@K\_ueda](https://discourse.nodered.org/u/K_ueda)
#### Post date: [13 December 2018 04:38 UTC](https://discourse.nodered.org/t/how-can-i-internet-accces-via-proxy-with-node-red-on-ubuntu/5742/3 "2018-12-13T04:38:26Z")

</div>

I am sorry to have written down  
"url" which exists in http-request is set with "test1"

---

<div class="post-metadata">

### Author: ![K\_ueda](https://avatars.discourse-cdn.com/v4/letter/k/d6d6ee/32.png) [@K\_ueda](https://discourse.nodered.org/u/K_ueda)
#### Post date: [14 December 2018 04:37 UTC](https://discourse.nodered.org/t/how-can-i-internet-accces-via-proxy-with-node-red-on-ubuntu/5742/4 "2018-12-14T04:37:05Z")

</div>

```
I amsorry to have writen down
【OS】
I wrote /etc/environmen
http_proxy="http://myproxy.local.co.jp:8080"
https_proxy="https://myproxy.local.co.jp:8080"
```
