Cannot access airflow web server via AWS load balancer HTTPS because airflow redirects me to HTTP

后端 未结 4 764
夕颜
夕颜 2021-01-05 08:32

I have an airflow web server configured at EC2, it listens at port 8080.

I have an AWS ALB(application load balancer) in front of the EC2, listen at https 80 (facing

4条回答
  •  萌比男神i
    2021-01-05 09:22

    User user389955 own solution is probably the best approach, but for anyone looking for a quick fix (or want a better idea on what is going on), this seems to be the culprit.

    In the following file (python distro may differ):

    /usr/local/lib/python3.5/dist-packages/gunicorn/config.py

    The following section prevents forwarded for headers from anything other than local

    class ForwardedAllowIPS(Setting):
        name = "forwarded_allow_ips"
        section = "Server Mechanics"
        cli = ["--forwarded-allow-ips"]
        meta = "STRING"
        validator = validate_string_to_list
        default = os.environ.get("FORWARDED_ALLOW_IPS", "127.0.0.1")
        desc = """\
            Front-end's IPs from which allowed to handle set secure headers.
            (comma separate).
    
            Set to ``*`` to disable checking of Front-end IPs (useful for setups
            where you don't know in advance the IP address of Front-end, but
            you still trust the environment).
    
            By default, the value of the ``FORWARDED_ALLOW_IPS`` environment
            variable. If it is not defined, the default is ``"127.0.0.1"``.
            """
    

    Changing from 127.0.0.1 to specific IP's or * if IP's unknown will do the trick.

    At this point, I haven't found a way to set this parameter from within airflow config itself. If I find a way, will update my answer.

提交回复
热议问题