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? |
have to configure the default port in your apache config. where is your apache listening on?
|
Quote:
|
Quote:
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. |
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? |
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.
|
Quote:
|
Quote:
|
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. |