[ 
https://issues.apache.org/jira/browse/AIRAVATA-3027?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17046989#comment-17046989
 ] 

Marcus Christie commented on AIRAVATA-3027:
-------------------------------------------

So it looks like with virtual hosts, the first defined virtual host for an ip 
address is the default. When a hostname doesn't match a ServerName in a set of 
virtualhost config files, the "first" one (first alphabetically) ends up 
handling the request.

https://wiki.centos.org/TipsAndTricks/ApacheVhostDefault gives a good overview 
of the problem and the two main approaches:

# have a first dummy virtualhost config that won't match anything real or has 
really low precedence (named 000-default.conf for example to get it to sort 
first)
# have a last dummy virtualhost config that matches everything, for example 
with {{ServerAlias *}}

I think the default.conf file the Ansible scripts already creates works kind of 
okay but it has two problems:
- it only works for port 80 requests
- "default" comes before "django-*" and "pga-*" but that's a little accidental. 
Should be named 000-default.conf or something better designed to come first.

I also need to figure out how to handle an HTTPS request for the default vhost 
when I don't have a valid certificate. Can I get it to redirect to port 80?

> Invalid HTTP_HOST header: 'django.simccs.scigap.org'. You may need to add 
> 'django.simccs.scigap.org' to ALLOWED_HOSTS.
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: AIRAVATA-3027
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-3027
>             Project: Airavata
>          Issue Type: Project
>            Reporter: Marcus Christie
>            Assignee: Marcus Christie
>            Priority: Major
>
> Getting lots of these error emails. I think the root cause is that HTTP 
> requests on the portal server are matching some virtual host that isn't 
> configured for that domain name. So for example, we might have a virtual host 
> for django.example.com, another one for django.example2.org, etc. but then an 
> HTTP request comes in for the servers IP address and Apache forwards the 
> request to one of the Django servers. 
> Ultimately what I want is to configure a default virtual host in Apache that 
> rejects a request for a non-matching domain name.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to