httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kurtis Rader <kra...@skepticism.us>
Subject Re: [users@httpd] Main domain and virtual hosts
Date Wed, 02 Sep 2015 03:27:04 GMT
On Tue, Sep 1, 2015 at 8:58 AM, Warren Bell <warrenbell2@gmail.com> wrote:

> I checked this morning and everything seems to be working now. I made a
> lot of DNS changes, so it probably just took some time to sort out.
>

Keep in mind that when changing your DNS configuration clients will
normally cache responses for at least as long as the TTL (time to live)
advertised by the authoritative DNS server for your domain. That's why it
is important to use alternative, trustworthy, external resolvers when
debugging problems involving host name resolution. That's why I recommended
querying the Google DNS servers with "host example.com 8.8.8.8" to verify
that "example.com" was in fact being resolved to the expected IP address.
Note, however, that clients can cache previously received DNS responses for
longer than the TTL value so a query of an independent source is no
guarantee your web browser, for example, is using current DNS data.

> If you issue a "host example.com 8.8.8.8" command on a UNIX like system
> does it report "example.com has address <myIP>”?
>
> Yes it resolves to the correct IP
>

Did you confirm that it did so before requests from your browser started
working or after?

> Also, when you say it "does not work and gets into a redirect loop"  how
> did you determine that? Did you do a controlled test with a CLI tool like
> curl with verbose (-v) output enabled and observe that you received a HTTP
> 301 redirect? Or did something else occur?
>
> Chrome displayed a redirect loop error page, I did not check further.
>

If you have access to a UNIX like system it is a good idea to debug such
problems using the "curl" CLI tool (or something similar such as "wget") so
you can more easily control what is happening (including whether redirects
should be followed) and dump the traffic (e.g., HTTP headers).

> What does the Apache HTTPD access and error logs show? Setting "LogLevel
> debug" might be necessary to get messages relevant to this problem.
>
> A lot of 302 lines, but then all of a sudden a 200 and now it works.
>
> MyHomeIP - - [01/Sep/2015:12:22:52 +0000] "GET /index.php/login HTTP/1.1"
> 302 364 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1)
> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
>

The common log format (CLF), which is the default, leaves a lot to be
desired. I highly recommend using a CustomLog format that includes, at a
minimum, "%{Host}i" so that the client provided HTTP host header is part of
the log message. This is what I use:

LogFormat "%{%Y-%m-%dT%H:%M:%S}t %{sec}t.%{usec_frac}t %>s %{error-notes}e
%D %B %h %{Host}i \"%r\" \"%{User-Agent}i\"" krader_custom

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

Mime
View raw message