• 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

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?
 

unclejed613

Well-Known Member
Most Helpful Member
302 is a redirect message...
 

JGLJGL

New Member
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.
 

Pommie

Well-Known Member
Most Helpful Member
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.
 

rjenkinsgb

Well-Known Member
Most Helpful Member
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.
 

eTech

Active Member
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
 

JGLJGL

New Member
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
 

JGLJGL

New Member
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://...).
 

eTech

Active Member
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
 

JGLJGL

New Member
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
 

eTech

Active Member
Reading up on 302:
The Web page is temporarily unavailable for unforeseen reasons.

However, the site may be performing a JavaScript redirect.


eT
 

unclejed613

Well-Known Member
Most Helpful Member
take the "HTTP/1.0" off the end of the GET string
 

JGLJGL

New Member
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
 

Latest threads

EE World Online Articles

Loading

 
Top