Why does Nginx give a 502 error only for mobile devices? - mobile

Using Nginx, I'm getting the error:
Error 502 - Bad Request
The server could not resolve your request for uri: http://domain.name/file/path
Oddly, I only get this error when my phone is using data from my cell carrier. The server serves everything just fine when I am using my phone on Wi-Fi or when I'm using a desktop computer. It even works when I am using my iPad conneted to my phone via Wi-Fi with my phone acting as a mobile hotspot.
The 502 error code suggests that there's an issue with reverse proxying or serving requests with php-fpm. I'm doing neither of these.
Because this error is happening only under specific circumstances, I'm thinking it has to be something with the request my phone is sending. (Nexus 5, Chrome, Android Lollipop)
My nginx.conf and other configuration files are passing tests. I used:
sudo nginx -t
and it said "the configuration file syntax is okay" and "configuration file test is successful."
What could be going on?

After tripple-checking my Nginx configuration, I had the idea to look at all tcp activity on port 80 of my server.
I installed tcpdump:
sudo apt-get install tcpdump
Then ran it, looking only for port 80 tcp traffic:
sudo tcpdump 'tcp port 80' -i eth0
I noticed that all other traffic was just 'IP', but when I sent a request from my phone, it was 'IP6'.
My server wasn't ipv6 enabled, but that's an easy fix with an additional listen directive:
listen [::]:80;

Related

PgAdmin4 website hosting on port 443 (https)

For my project i configured the postgresql and pgadmin4 .. but now i want to make the website secure with proper DNS name and run over port 443. DNS is also done but how to make it run over 443 from 80. ie., from http to https. i made changes in httpd.conf file and added certificates required too. but website is not loading ,still the website is opening on http:// ip address but not on https://
I tried making changes in configuration file too
LL be Much thankful.
how to configure pgadmi4 on port 443 https

sailsjs refuses connection on address localhost

I am developing an app consisting sailsjs in backend and ng-boilerplate in frontend. In my dev machine(64 bit ubuntu) is all working. But when I put my app for testing purposes into a 32bit debian machine, sailsjs is refusing connection on address
http://localhost:1337/blog.
When I replace localhost with hostname of my debian-machine, like that:
http://debian:1337/blog, all is going to work.
This is error message in browser console:
GET http://localhost:1337/blog net::ERR_CONNECTION_REFUSED
This is content my /etc/hosts file:
127.0.0.1 localhost
#127.0.0.1 debian
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters</pre>
This is content of my /etc/hostname:
debian
Could someone solve this mystery?
So, I add some things:
/config/env/development.js:
module.exports = {
models: {
connection: 'PeeterMongodbServer',
migrate: 'alter'
}
};
My /config/http.js is just empty, it means as it was when I have sails installed.
Try ifconfig or ipconfig as applicable
FOR e.g inet 192.168.1.64
Also update your etc/hosts file
$ cat /etc/hosts
127.0.0.1 localhost
192.168.1.64 debian
Pls ensure this is tabbed between IP address and hostname.

GET /favicon.icon 404 error in ngrok

On running ngrok and going to the suggested url, i get
GET /favicon.icon 404 error in ngrok.
In which folder does ngrok search for the favicon.ico file ?
How do i fix this ?
Very new to ngrok. Do help me out
Thanks in advance
I ran into a similar problem with URIs from ngrok being served as 404s.
I have a local Apache, PHP and MySQL stack setup on macOS using *.dev domains.
So in my case, I needed to set the host-header option in ngrok to match the hostname of the virtual host Apache was configured for.
Here's the relevant part of my Apache virtual host configuration:
<VirtualHost *:80>
ServerName example.dev
ServerAlias www.example.dev
...
UseCanonicalName Off
</VirtualHost>
The necessary ngrok arguments to tunnel requests to my private development domain were:
$ ngrok http example.dev:80 -host-header=example.dev
What ngrok do is,make tunnels to localhost.That allows you tunnel requests from Internet to your local machine.
You can see following details after running : ngrok http 8888
Tunnel Status
online
Version 2.0.19/2.0.19
Web Interface http://127.0.0.1:4040
Forwarding http://299954c1.ngrok.io -> localhost:8888
Now all the data intended for 'http://299954c1.ngrok.io' url which is publically accessible will come to your local machine at port 8888
You need to have some server running on your local machine at port 8888 which can serve 'favicon.icon' static file
If you are able to get icon by hitting : localhost:8888/favicon.icon in your browser, You will surely get it from http://299954c1.ngrok.io/favicon.icon

Connecting a secured websocket on Google Appengine frontend with managed VM with nodejs runtime

I've trouble in connecting to a wss secured socket server via google appengine frontend with managed VM support.
buy default google exposes only port 8080 in docker image google/nodejs-runtime, Even if expose port 8443 in Dockerfile like below i can connect only to http://localhost:8080 not https://localhost:8443
FROM google/nodejs
WORKDIR /app
ADD package.json /app/
RUN npm install
ADD . /app
EXPOSE 8443
CMD []
ENTRYPOINT ["/nodejs/bin/npm", "start"]
Still i can see port 8080 include in the container
"/nodejs/bin/npm start 8443/tcp, 0.0.0.0:8080->8080/tcp
If i log in to my managed vm instance and run the container image with
docker run -d -p 8443:8443 nodejs.default.wss-check:latest
and try
$curl https://localhost:8443
I get curl: (60) SSL certificate problem: unable to get local issuer certificate, It looks like its connecting but i've to use realdomain name
I've created a issue in github aswell https://github.com/GoogleCloudPlatform/appengine-nodejs-quickstart/issues/13, but not that helpful.
Same set up works like a charm in normal compute instance. but it doesn't auto scale.
Any help on this issue will be appreciated.
The reason you can't curl to https on localhost (curl: (60) SSL certificate problem: unable to get local issuer certificate) is because "localhost" is unknown to any CA. You need to run curl -k https://localhost:8443 to get it to ignore the lack of a certificate for localhost.
Looks like currently Google Managed VM supports Websocket connection only on JAVA
Even if you try websocket connection on with nodejs on GMV it defaults to polling transport. if you wanna see this in live you can use set socket transports, deploy to live and look in to console- network and see which transport its using!
socket.set('transports', [
'websocket'
, 'flashsocket'
, 'htmlfile'
, 'xhr-polling'
, 'jsonp-polling'
]);
We have to wait untill google implements websocket support in Managed VM. If anyone get this working on GMV, Please comment here :)

App Engine Go SDK web server running in Vagrant guest (with port forwarding) not reachable from host

I'm running GAE dev server within a Vagrant guest precise64 box with the following network setup (in my Vagrantfile):
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.network :forwarded_port, guest: 8080, host: 9090
end
Which does its thing:
[default] Forwarding ports...
[default] -- 8080 => 9090 (adapter 1)
I start my App Engine server with:
goapp serve
or
dev_appserver.py myappfolder
This starts app engine dev server as expected:
INFO 2013-11-22 dispatcher.py] Starting module running at: http://localhost:8080
In all cases, I'm able to ssh in to the Vagrant guest and curl localhost:8080 successfully.
Unfortunately, from the host I'm unable to get a response from localhost:9090 when running GAE dev web server. Additionally, I've made sure that I don't have anything interfering with the port 9090 on the host machine. Also, I'm almost positive this isn't related to Vagrant as I spun up a quick node.js web server on 8080 and was able to reach it from the host. What am I missing?!!!
You must run the Google App Engine Go dev web server on 0.0.0.0 when leveraging Vagrant port forwarding. Like so:
goapp serve -host=0.0.0.0
See the answers here for more info on ensuring the guest web server is not bound to 127.0.0.1 which is loopback. Web servers that bind to 127.0.0.1 (like App Engine Go dev web server does) by default should be overridden to use 0.0.0.0.

Resources