1

I have installed Nginx in my server and i am getting a TCP request from a GPS + GPRS device. When i access the access.log i find this.

126.51.10.6 - - [06/Jun/2016:16:46:53 -0400] "GET / HTTP/1.1" 500 32 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.86 Safari/537.36"
126.51.10.6 - - [06/Jun/2016:16:46:54 -0400] "GET / HTTP/1.1" 500 32 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.86 Safari/537.36"
223.229.182.77 - - [06/Jun/2016:16:47:08 -0400] "(009591810720BP05000009591810720160606A1254.6425N07738.5244E000.0204656000.0000000000L00000033)" 400 181 "-" "-"
106.200.237.222 - - [06/Jun/2016:16:47:28 -0400] "(009591810720BP05000009591810720160606A1254.6418N07738.5253E000.0204716000.0000000000L00000033)" 400 181 "-" "-"
223.190.121.5 - - [06/Jun/2016:16:47:48 -0400] "(009591810720BP05000009591810720160606A1254.6435N07738.5247E000.0204736000.0000000000L00000033)" 400 181 "-" "-"

Clearly, first two are from web-browser and if a server was running successfully, those request would have been returned with 200 and its happening also. I want to process the third request and i am unable to do so. Can some one help me to identify what kind of request is that and how to process the same.

Thanks.

srj0408
  • 25
  • 1
  • 1
  • 6
  • nginx is primarily a web server software for HTTP requests, and this request is something else. It looks like GPS coordinates. You should check the device API documentation for closer details. – Tero Kilkanen Jun 08 '16 at 09:33
  • @TeroKilkanen: yes, data is GPS coordinates from a device but as per the device documentation, device communicate to server using TCP. `This tracker connects to platform server with TCP. The way for connection is that device connects to the platform server forwardly.` This is what device manual say. – srj0408 Jun 09 '16 at 20:33
  • @TeroKilkanen and when i checked my log for other web-requests, server response is same i.e. 400 although, my server is processing the request and the app which i am running is responding fine. Here is the other log . `yyy.51.18.xxx - - [09/Jun/2016:16:35:44 -0400] "GET /?shailendra=1234 HTTP/1.1" 200 159 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.86 Safari/537.36" 27.57.108.79 - - [09/Jun/2016:16:36:04 -0400] "(009591810720BP05000009591810720111213V0000.0000N00000.0000E000.0203553000.0000000000L00000033)" 400 181 "-" "-" ` – srj0408 Jun 09 '16 at 20:37

1 Answers1

0

The requests are not HTTP requests, you should have a server side software that binds to the port that this software sends its data to, and can process these requests.

If the device sends the data to port 80, that is a bad design from the device manufacturer, since port 80 is used for HTTP traffic.

You can't do anything to these requests with nginx, since it is a web server software.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • kikanen: my Nginx configuration file for my app is `server { listen 80; listen 8000; server_name localhost; location / { include uwsgi_params; uwsgi_pass unix:/tmp/myproject.sock; } }` and my application is serving all the requests coming from a web-browser. I don't have much control over the device but i can change the IP and PORT where device is sending data. But still i get 400 as response. I am forwarding all the request to my application. – srj0408 Jun 10 '16 at 09:53
  • You cannot send the requests to your application via nginx. You need you application to bind directly to a TCP port, and process the requests using TCP sockets. – Tero Kilkanen Jun 11 '16 at 12:37
  • You mean to say that i have to create open a socket to a port where my device is sending data using my application which in my case is Python. Probably this would work - if i am right? [link](https://docs.python.org/2/library/socketserver.html) and [link1](https://pymotw.com/2/SocketServer/) – srj0408 Jun 11 '16 at 13:37
  • Looking quickly at it, I think this would work. – Tero Kilkanen Jun 12 '16 at 01:27
  • @ Tero Kilkanen : And it worked, thanks a lot. Here goes the log. `27.57.102.238 wrote: (009591810720BP05000009591810720160612A1254.6435N07738.5243E000.0193550000.0000000000L00000033) 223.229.212.74 wrote: (009591810720BP05000009591810720160612A1254.6433N07738.5240E000.0193610000.0000000000L00000033) ` – srj0408 Jun 12 '16 at 19:37