LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Cannot Access Apache Web URLs Remotely Without Port Number (https://www.linuxquestions.org/questions/linux-server-73/cannot-access-apache-web-urls-remotely-without-port-number-707099/)

nikhil010586 02-24-2009 06:36 AM

Cannot Access Apache Web URLs Remotely Without Port Number
 
Hi,

I have hosted a few pages on my Apache Web Server. The pages are accessible locally by simply hitting on the URL http://localhost/pageName.html with all the page resources(images and CSS) intact. However, when I try to access the same page remotely from some other machine, Apache throws a Bad Request Error message. Also, the page body is visible if I append the port number to the same URL viz. http://192.168.0.33:80/pageName.html . But in that case, the page resources are not visible.
I set up a sniffer to see where exactly is the browser getting at, and found that Apache won't cater the request unless you explicitly specify the port number.
Of all this, I understand that http requests are not being forwarded automatically to port 80 on my host machine. Is there a way to solve this problem so that I can access my Web server remotely?

chitambira 02-24-2009 07:22 AM

have to configure the default port in your apache config. where is your apache listening on?

nikhil010586 02-25-2009 12:22 AM

Quote:

Originally Posted by chitambira (Post 3455580)
have to configure the default port in your apache config. where is your apache listening on?

Its listening on the default port 80. The Listen attribute in /etc/httpd/httpd.conf is set to 80.

maas187 02-25-2009 01:28 AM

Quote:

Originally Posted by nikhil010586 (Post 3455531)
Hi,

I have hosted a few pages on my Apache Web Server. The pages are accessible locally by simply hitting on the URL http://localhost/pageName.html with all the page resources(images and CSS) intact. However, when I try to access the same page remotely from some other machine, Apache throws a Bad Request Error message. Also, the page body is visible if I append the port number to the same URL viz. http://192.168.0.33:80/pageName.html . But in that case, the page resources are not visible.
I set up a sniffer to see where exactly is the browser getting at, and found that Apache won't cater the request unless you explicitly specify the port number.
Of all this, I understand that http requests are not being forwarded automatically to port 80 on my host machine. Is there a way to solve this problem so that I can access my Web server remotely?


show me the result of those commands.

1 - netstat -at and netstat -ant
2 - iptables -L -n

1st 2 commands would give me a better idea on what port apache is running on
and the 2nd to see if your firewall is not blocking apache.

pcunix 02-25-2009 11:25 AM

Naw, there's something more strange afoot here.

Port 80 isn't blocked or he couldn't get to it by specifying the port directly.

I don't think the server is at fault here. I think it's the CLIENT that is not defaulting to port 80 when it should.

Does the sniffer show that?

kuhazor 02-25-2009 04:25 PM

Make sure your name based virtual domains setting is not on. If it is then you must create virtual server entry for the host domain as well as any virtual domains.

nikhil010586 03-07-2009 03:05 AM

Quote:

Originally Posted by kuhazor (Post 3457421)
Make sure your name based virtual domains setting is not on. If it is then you must create virtual server entry for the host domain as well as any virtual domains.

How do I check that?

nikhil010586 03-07-2009 03:10 AM

Quote:

Originally Posted by pcunix (Post 3457155)
Naw, there's something more strange afoot here.

Port 80 isn't blocked or he couldn't get to it by specifying the port directly.

I don't think the server is at fault here. I think it's the CLIENT that is not defaulting to port 80 when it should.

Does the sniffer show that?

The sniffer did not show port 80 appended to the URL unless explicitly specified. I'm not able to figure out the reason for such a strange behaviour where the requests cannot be handled directly by my Apache Web server. A direct hit on http://local-ip gives an Apache error message for Bad request. This means my http requests are being redirected to Apache web server.

nikhil010586 03-07-2009 04:27 AM

Finally found a solution for my own problem. And that too in some modsecurity configuration files. The culprit here was a file named modsecurity_crs_21_protocol_anomalies.conf in /etc/httpd/ directory. Checked through the logs just to find an error marked as SEVERE which had a message "Host header is a numeric IP address".

To get rid of it, I commented out the line which filtered out requests coming for specific IP address, 127.0.0.1 included. I'd like to mention here that my apache web server showed up on the same machine on hitting http://localhost but not after hitting on http://127.0.0.1 . The line that I commented out was as follows:

# Check that the host header is not an IP address
#
SecRule REQUEST_HEADERS:Host "^[\d\.]+$" "phase:2,t:none,deny,log,auditlog,status:400,msg:'Host header is a numeric IP address', severity:'2',id:'960017',tag:'PROTOCOL_VIOLATION/IP_HOST'"

Thanks for all those who actively participated in the discussion!
Nikhil.


All times are GMT -5. The time now is 11:38 PM.