arduino-libraries / Ethernet

Ethernet Library for Arduino
http://arduino.cc/
258 stars 265 forks source link

403 error with default URL in WebClientRepeating sketch #227

Open aliphys opened 1 year ago

aliphys commented 1 year ago

Describe the problem

Making a page request to www.arduino.cc results in a 403 error.

To reproduce

  1. Mount the MKR ETH Shield onto the MKR WiFi 1010
  2. Connect an ethernet cable from the MKR ETH Shield to a router. Similar to image below image
  3. Compile and upload the WebClientRepeating.ino sketch without any modifications. While uploading, use a thin plastic stylus to reset the board.
  4. Upon establishing a connection, a message similar to the following is continuously displayed.
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    <TITLE>ERROR: The request could not be satisfied</TITLE>
    </HEAD><BODY>
    <H1>403 ERROR</H1>
    <H2>The request could not be satisfied.</H2>
    <HR noshade size="1px">
    Bad request.
    We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
    <BR clear="all">
    If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
    <BR clear="all">
    <HR noshade size="1px">
    <PRE>
    Generated by cloudfront (CloudFront)
    Request ID: D1LyjozCmyPpPFI2k_ZlUC7_Nu5Ea6ljr-GmFIFB4Lu_A0Zi7oYDug==


### Expected behavior
According to the line below, the sketch should connect to the arduino.cc website.
https://github.com/arduino-libraries/Ethernet/blob/d31148d983ba61ac6340349ada8a0bfd09bd3cc0/examples/WebClientRepeating/WebClientRepeating.ino#L40
https://github.com/arduino-libraries/Ethernet/blob/d31148d983ba61ac6340349ada8a0bfd09bd3cc0/examples/WebClientRepeating/WebClientRepeating.ino#L104-L126

However, it does not get the full HTML website. But rather a Cloudfire error message.

### Arduino CLI version

0.34

### Operating system

Linux

### Operating system version

Ubuntu 22.04.03 LTS
aliphys commented 1 year ago

When replacing www.arduino.cc with www.google.com a 404 error (instead of the 403 error) occurs.

<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 404 (Not Found)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>404.</b> <ins>That’s an error.</ins>
  <p>The requested URL <code>/latest.txt</code> was not found on this server.  <ins>That’s all we know.</ins>
connecting...
HTTP/1.1 404 Not Found
Content-Type: text/html; charset=UTF-8
Referrer-Policy: no-referrer
Content-Length: 1571
Date: Wed, 23 Aug 2023 09:18:42 GMT
Connection: close