Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

SSL over TCP

Status
Not open for further replies.

JGLJGL

New Member
Hi, I'm using a TCP connection with a SIM7000 module, but I receive 302 response. So I suposse I need to use SSL over TCP. Any suggestions?
 
302 is a redirect message...
 
Yes, but it sends me the redirect message(302) when trying to communicate with www.atesens.com, which has https://. But when trying, for example, with httpbin.org which has http:// it works fine (response 200). So I thought maybe could be something related to SSL certificates.
 
I had this problem about a year ago. If I remember correctly, the redirect is to a page explaining that only https is allowed. I didn't find a solution. I was using an ESP8266. Good luck.

Mike.
 
If you get a redirect such as a 302, you have to make a new request to whatever URL is given in the 302 data. It will provide a new URL as well as the numeric code.

It just means the URL you must use is not the one you requested. It appears to be a redirect to the login page https://www.atesens.com/login

A web browser would follow the redirect instantly so you would never see that message in the normal course of things.
 
Yes, but it sends me the redirect message(302) when trying to communicate with www.atesens.com, which has https://. But when trying, for example, with httpbin.org which has http:// it works fine (response 200). So I thought maybe could be something related to SSL certificates.

Hi

It could be that the site has a URL re-direct enabled. This will provide functionality where a URL typed as http:// will be intercepted and "re-directed" to https:// as a convenience to the user. I used to do this as an ISP in my previous life.

eT
 
I've tried with https://www.atesens.com/login but also 302 response.
at comand 302.png

AT+CIPSEND

>
GET https://www.atesens.com/login HTTP/1.1


SEND OK
HTTP/1.1 302 Found
Cache-Control: no-cache
Content-length: 0
Location: https:///login

I've also tried to put http:// instead of https:// but the same error.
Also you may notice that the port I've selected is 80, that because when I select 443 this is the response I get (the other configuration being the same as in the image):
AT+CIPSEND

>
GET https://www.atesens.com/login HTTP/1.1


SEND OK
 
eTech I have tried diferent options, but also have tried connecting to port 80 and then attempting to communicate over por 80 (http://...).
And also have tried to connet to port 443 and then attempting to communicate over 443 (https://...).
 
Try this:
Connect using port 80
Do Get using http login url
When response 302 is returned
Do Get using the url in “location” field of 302 response message.

eT
 
OK, this is what I get with the initial login:
TCPFORO4.png


And looking at "Location", I gues I have to put https:// , but I get the same response.
If I try the https:// with port 443 connection this is what I get, something, a character that can't be read:
TCPFORO5.png
 
Reading up on 302:
The Web page is temporarily unavailable for unforeseen reasons.

However, the site may be performing a JavaScript redirect.


eT
 
take the "HTTP/1.0" off the end of the GET string
 
Hi, I forgot to tell that I made to do both GET and POST in HTTPS. (With that programm, "AT Command Tester").

But not being able to achieve them if trying to send the comands manually for example with "RealTerm" or with a bridge sketch in "Arduino". I get this responsens por GET and POST int HTTPS:
+SHREQ: "POST",400,800
+SHREQ: "GET",400,800

Any idea why it works in one application and not in others?

Here I add the commands I send in case it is helpfull (POST case):
Code:
AT+SHDISC
AT+CGREG?

AT+SAPBR=3,1,"APN","ep.inetd.gdsp"

AT+SAPBR=1,1
AT+CNACT=1,"ep.inetd.gdsp"

AT+SAPBR=2,1
AT+CNACT?

AT+CFSTERM
AT+CFSINIT
AT+CSSLCFG="convert",2,"rapidssl.cer"
AT+SHSSL=1,"rapidssl.cer"

AT+SHCONF="URL","https://www.atesens.com"
AT+SHCONF="BODYLEN",1024
AT+SHCONF="HEADERLEN",350
AT+SHCONF="IPVER",0
AT+SHCONF="TIMEOUT",30

AT+SHCONN

AT+SHAHEAD="Host:","www.atesens.com"
AT+SHAHEAD="Accept:","*/*"
AT+SHAHEAD="Content-Type:","application/json"
AT+SHAHEAD="User-Agent:","Opera"

AT+SHBOD="{'PM1':4.0}",11

AT+SHREQ="/api/v1/4444/telemetry",3

AT+SHDISC
 
a 400 error means: "400 Bad Request The server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, size too large, invalid request message framing, or deceptive request routing)" also, where did you get rapidssl.cer from? that cert should be atesens.com's public key if i'm not mistaken
why do you have such a large header and body length, when your actual header and body length are so small?
ipver should b 4 or 6, not 0.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top