HTTP error 504 from WAN but works OK inside LAN

Issues related to configuring your network
Post Reply
webanditstudio
Posts: 9
Joined: 2019/08/15 12:07:51

HTTP error 504 from WAN but works OK inside LAN

Post by webanditstudio » 2019/08/24 11:55:46

Hi I've been struggling with this for days so I'd really appreciate some help please.
I have apache working from inside my LAN but get a HTTP error 504 from outside.
I have set up a port forwarding rule that I believe is working.

# netstat cpatn

reports the connection attempt as follows:

tcp6 0 0 192.168.86.248:80 213.205.192.224:44566 ESTABLISHED 28632/httpd
tcp6 0 0 192.168.86.248:80 213.205.192.224:16360 TIME_WAIT -

213.205.192.134 is the IP address of the mobile phone I'm using but the above is reported every time I try to open the webpage.
192.168.86.248 is the local LAN address of the centos server.
Any clues please?

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: HTTP error 504 from WAN but works OK inside LAN

Post by TrevorH » 2019/08/24 12:20:58

504 is a gateway timeout. Are you using your httpd to proxy connections to other servers?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

webanditstudio
Posts: 9
Joined: 2019/08/15 12:07:51

Re: HTTP error 504 from WAN but works OK inside LAN

Post by webanditstudio » 2019/08/24 12:40:05

No it is just to serve an intranet website mainly to devices on the lan but very occasionally to access the intranet from outside.

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: HTTP error 504 from WAN but works OK inside LAN

Post by TrevorH » 2019/08/24 14:27:31

Are you sure the 504 is coming from your server?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

webanditstudio
Posts: 9
Joined: 2019/08/15 12:07:51

Re: HTTP error 504 from WAN but works OK inside LAN

Post by webanditstudio » 2019/08/24 22:41:41

Hmm, not sure. It's presented by the browser after not receiving a response from the server.
It appears to me that the webpage request gets through my router's port forwarding rules; into the server; connects to the webserver but the webserver does not respond by delivering the webpage. It's a httpd apache server with a wordpress installation that works fine from within the lan.
The server can access the internet just fine too so I'm thinking there's a firewall issue maybe. Could it be an SE issue? I'm lost.

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: HTTP error 504 from WAN but works OK inside LAN

Post by TrevorH » 2019/08/24 23:25:12

If it connects to your server then it should log something in /var/log/httpd/access_log or in error_log.

If you're unsure, yum install tcpdump and then run it to capture network traffic on port 80 and watch it to see if it sees the requests come through. If they don't then maybe your mobile networkor your ISP is blocking them or your router forwarding is not correct
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

webanditstudio
Posts: 9
Joined: 2019/08/15 12:07:51

Re: HTTP error 504 from WAN but works OK inside LAN

Post by webanditstudio » 2019/08/25 12:34:15

Thanks for the help TrevorH,

Here is the relevant bit from httpd access.log

213.205.241.116 - - [25/Aug/2019:13:26:42 +0100] "GET / HTTP/1.1" 302 - "-" "Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/10.1 Chrome/71.0.3578.99 Mobile Safari/537.36"
213.205.241.116 - - [25/Aug/2019:13:27:34 +0100] "-" 408 - "-" "-"
213.205.241.116 - - [25/Aug/2019:13:27:34 +0100] "-" 408 - "-" "-"

The last number of the IP address is different to what whatsmyip reports but the rest match my network operator.

I'm also going to try tcpdump as you suggest.

webanditstudio
Posts: 9
Joined: 2019/08/15 12:07:51

Re: HTTP error 504 from WAN but works OK inside LAN

Post by webanditstudio » 2019/08/25 13:21:36

These are the lines (from the hundreds) from the output of tcpdump that refer to my mobile address:
(taken from a moment before I hit the go button on the mobile to a few seconds after the mobile reported reported the HTTP 504 error)
(the centos server is called rr-svr)

14:06:34.435528 IP rr-svr.lan.http > 213.205.241.116.16308: Flags [P.], seq 3997846622:3997847148, ack 3638065329, win 235, options [nop,nop,TS val 4294814864 ecr 1706879512], length 526: HTTP: HTTP/1.1 302 Found

14:06:34.479788 IP 213.205.241.116.16308 > rr-svr.lan.http: Flags [.], ack 526, win 340, options [nop,nop,TS val 1706886169 ecr 4294814864], length 0
14:06:34.494570 IP 213.205.241.116.16306 > rr-svr.lan.http: Flags [P.], seq 2385567790:2385568292, ack 1802555915, win 336, options [nop,nop,TS val 1706886172 ecr 4294808206], length 502: HTTP: GET / HTTP/1.1
14:06:34.494664 IP rr-svr.lan.http > 213.205.241.116.16306: Flags [.], ack 502, win 235, options [nop,nop,TS val 4294814923 ecr 1706886172], length 0

14:06:35.637356 IP rr-svr.lan.http > 213.205.241.116.16306: Flags [P.], seq 1:527, ack 502, win 235, options [nop,nop,TS val 4294816065 ecr 1706886172], length 526: HTTP: HTTP/1.1 302 Found
14:06:35.681386 IP 213.205.241.116.16306 > rr-svr.lan.http: Flags [.], ack 527, win 340, options [nop,nop,TS val 1706887372 ecr 4294816065], length 0

14:06:39.458969 IP rr-svr.lan.http > 213.205.241.116.16308: Flags [F.], seq 526, ack 1, win 235, options [nop,nop,TS val 4294819887 ecr 1706886169], length 0
14:06:39.502903 IP 213.205.241.116.16308 > rr-svr.lan.http: Flags [F.], seq 1, ack 527, win 340, options [nop,nop,TS val 1706891194 ecr 4294819887], length 0
14:06:39.502983 IP rr-svr.lan.http > 213.205.241.116.16308: Flags [.], ack 2, win 235, options [nop,nop,TS val 4294819931 ecr 1706891194], length 0

14:06:40.642805 IP rr-svr.lan.http > 213.205.241.116.16306: Flags [F.], seq 527, ack 502, win 235, options [nop,nop,TS val 4294821071 ecr 1706887372], length 0
14:06:40.687919 IP 213.205.241.116.16306 > rr-svr.lan.http: Flags [F.], seq 502, ack 528, win 340, options [nop,nop,TS val 1706892377 ecr 4294821071], length 0
14:06:40.688017 IP rr-svr.lan.http > 213.205.241.116.16306: Flags [.], ack 503, win 235, options [nop,nop,TS val 4294821116 ecr 1706892377], length 0

Post Reply