# Making Arduino Ethernet work through proxy server

**URL:** <https://forum.arduino.cc/t/making-arduino-ethernet-work-through-proxy-server/107641>\
**Category:** Networking, Protocols, and Devices\
**Created:** [June 14, 2012, 10:41am UTC](https://forum.arduino.cc/t/making-arduino-ethernet-work-through-proxy-server/107641 "2012-06-14T10:41:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 14, 2012, 10:41am UTC](https://forum.arduino.cc/t/making-arduino-ethernet-work-through-proxy-server/107641/1 "2012-06-14T10:41:48Z")

</div>

Hi,

I am working on a project that involves using Arduino Ethernet shield as a client that reads data from a web page. The problem is that I am using this project in the university network that has evrything running through a proxy server. On other networks such as my home network it can access the page and read the data easily.

I was thinking of modifying the Ethernet.h file myself but I luck a bit of networking knowledge so I didn't know how to begin. Is there a possible way out of this problem

Thanks.

---

<div class="post-metadata">

**Author:** ![SurferTim](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/surfertim/32/1072341_2.png) [@SurferTim](https://forum.arduino.cc/u/SurferTim)\
**Post date:** [June 14, 2012, 11:08am UTC](https://forum.arduino.cc/t/making-arduino-ethernet-work-through-proxy-server/107641/2 "2012-06-14T11:08:20Z")

</div>

What are the symptoms of the proxy server fail?  
Does your university network require proxy settings in your computer?  
Have you talked to the network administrator at the university about it?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 14, 2012, 11:46am UTC](https://forum.arduino.cc/t/making-arduino-ethernet-work-through-proxy-server/107641/3 "2012-06-14T11:46:22Z")

</div>

The symptoms are that It fails to establish connection to the server. I have an "if else" loop that checks this as shown below

```cpp
 if (client.connect(server, 80)) {
    Serial.println("connected");
    lcd.clear();
    lcd.print("connected");
    // get the informationi from the server
    client.println("GET /u/34458509/RemoteTest.html HTTP/1.0");  
    client.println();
    lcd.clear();
    lcd.println(inString);

    //Connected - Read the page
    return readPage(); //go and read the output

  }else{
    lcd.clear();
    lcd.print("connection fail");
    return "connection fail";

  }

```

So when using it in the university network, the lcd prints out "connection fail".

In order to connect my PC to university network I did some proxy settings and when I talked to the network admin he suggested that I have to do the same proxy settings on the arduino ethernet as well. So i got stuck on how to go about it.

Thanks.

---

<div class="post-metadata">

**Author:** ![pylon](https://avatars.discourse-cdn.com/v4/letter/p/59ef9b/32.png) [@pylon](https://forum.arduino.cc/u/pylon)\
**Post date:** [June 14, 2012, 12:38pm UTC](https://forum.arduino.cc/t/making-arduino-ethernet-work-through-proxy-server/107641/4 "2012-06-14T12:38:27Z")

</div>

That's not as easy as to make some settings in the Ethernet library. You have to implement your sketch differently if running at home or running behind the proxy. Behind the proxy you connect to the proxy and tell it to make an outgoing connection to the desired server. You have to decide if you wanna make a different version or if you wanna have both versions in one sketch.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 14, 2012, 1:53pm UTC](https://forum.arduino.cc/t/making-arduino-ethernet-work-through-proxy-server/107641/5 "2012-06-14T13:53:14Z")

</div>

I am just planning to implement the one that runs through the proxy. However, the problem is getting to tell the proxy to make connection to the desired server using the ethernet library.

---

<div class="post-metadata">

**Author:** ![pylon](https://avatars.discourse-cdn.com/v4/letter/p/59ef9b/32.png) [@pylon](https://forum.arduino.cc/u/pylon)\
**Post date:** [June 14, 2012, 3:05pm UTC](https://forum.arduino.cc/t/making-arduino-ethernet-work-through-proxy-server/107641/6 "2012-06-14T15:05:39Z")

</div>

Depending on the type of proxy in duty it can be just the change of the server address to that of the proxy and changing the path in the GET line to be the full URL you wanna access, e.g.

```cpp
client.println("GET http://www.example.com/u/34458509/RemoteTest.html HTTP/1.0");

```

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 16, 2012, 4:41am UTC](https://forum.arduino.cc/t/making-arduino-ethernet-work-through-proxy-server/107641/7 "2012-06-16T04:41:38Z")

</div>

Thanks guys. I was able to run the arduino ethernet through the proxy server. I did some changes on the port number as well after consulting with the network admin again

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [November 3, 2012, 8:35am UTC](https://forum.arduino.cc/t/making-arduino-ethernet-work-through-proxy-server/107641/8 "2012-11-03T08:35:13Z")

</div>

Hi mc63,  
I am having the same problem as you, can you please tell me what you did to solve proxy server problem?  
reply asap.  
🙂

---

<div class="post-metadata">

**Author:** ![SurferTim](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/surfertim/32/1072341_2.png) [@SurferTim](https://forum.arduino.cc/u/SurferTim)\
**Post date:** [November 3, 2012, 11:09am UTC](https://forum.arduino.cc/t/making-arduino-ethernet-work-through-proxy-server/107641/9 "2012-11-03T11:09:52Z")

</div>

I recommend talking to your network administrator. He/she will know the localnet ip and port to use for the proxy. If I use a proxy on my system, it is on the standard gateway, but redirects to a different port, like 8080.

edit: Use the proxy server localnet ip as the gateway in your network settings, and the proxy redirect port in the connection request.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 10:38am UTC](https://forum.arduino.cc/t/making-arduino-ethernet-work-through-proxy-server/107641/10 "2021-05-06T10:38:01Z")

</div>

Closed on May 6, 2021, 10:38am UTC


