Django Invalid HTTP_HOST header on Apache - fix using Require?

后端 未结 2 1258
轮回少年
轮回少年 2021-01-12 22:59

A couple weeks ago, I had a wonderful time setting up an Apache and Django configuration to work while forcing SSL and operating behind an AWS load balancer.

Now th

2条回答
  •  鱼传尺愫
    2021-01-12 23:11

    So, after messing with this for a long time I figured out that the problem I was dealing with may have something to do with the hostname reverse DNS lookup failing, since the IP address was pointing to an AWS EC2 instance instead of my domain.

    After finally giving up on getting it right I returned to the post on how to disable the log error, and tried using the env variable, which seems to be working.

    Apparently the correct format for Require is:

    
        SetEnvIfNoCase Host example\.com VALID_HOST
        Require env VALID_HOST
        Options
    
    

    These guys had it right, just need to update it for the current "Require" directive.

    How to disable Django's invalid HTTP_HOST error?

提交回复
热议问题