Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 error with default URL in WebClientRepeating sketch #227

Open
aliphys opened this issue Aug 23, 2023 · 1 comment
Open

403 error with default URL in WebClientRepeating sketch #227

aliphys opened this issue Aug 23, 2023 · 1 comment

Comments

@aliphys
Copy link
Member

aliphys commented Aug 23, 2023

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.

char server[] = "www.arduino.cc"; // also change the Host line in httpRequest()

// this method makes a HTTP connection to the server:
void httpRequest() {
// close any connection before send a new request.
// This will free the socket on the Ethernet shield
client.stop();
// if there's a successful connection:
if (client.connect(server, 80)) {
Serial.println("connecting...");
// send the HTTP GET request:
client.println("GET /latest.txt HTTP/1.1");
client.println("Host: www.arduino.cc");
client.println("User-Agent: arduino-ethernet");
client.println("Connection: close");
client.println();
// note the time that the connection was made:
lastConnectionTime = millis();
} else {
// if you couldn't make a connection:
Serial.println("connection failed");
}
}

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
Copy link
Member Author

aliphys commented Aug 23, 2023

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

@per1234 per1234 changed the title [AE-147] 403 error with default URL in WebClientRepeating sketch 403 error with default URL in WebClientRepeating sketch Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant