vitaly-krugl opened a new issue #12291:
URL: https://github.com/apache/airflow/issues/12291


   **Apache Airflow version**: 1.10.11
   
   **Environment**:
   
   - **OS** (e.g. from /etc/os-release):
   - **Kernel** (e.g. `uname -a`): Linux
   
   
   **What happened**: After manually triggering a DAG from Airflow Web GUI, 
Airflow attempted to open the /admin/ page using http:// instead of the the 
https:// scheme, and so failed to connect because my webserver only supports 
SSL connections.
   
   **What you expected to happen**:
   I expected Airflow to open the /admin/ page using the https:// scheme 
because my webserver only supports SSL connections.
   
   Furthermore, I have the `[webserver]` `base_url` option set up using 
https:// scheme.
   
   **How to reproduce it**:
   When I examine the HTML source of the `<title>Airflow - DAGs</title>` page, 
I see that the `<!-- Trigger Dag -->` blocks have "origin" url args configured 
with "http", as in this example:
   ```
                   <!-- Trigger Dag -->
                   <a 
href="/admin/airflow/trigger?dag_id=airflow_db_cleanup&origin=http://emp-wf-vkruglik.mydomain.com/admin/";>
                       <span class="glyphicon glyphicon-play-circle" 
aria-hidden="true" data-original-title="Trigger Dag"></span>
                   </a>
   ```
   
    I have the `[webserver]` `base_url` option set up as 
   ```
   base_url = https://emp-wf-vkruglik.mydomain.com
   ```
   
   Note that in my network setup, there is an apache server that acts as SSL 
terminator. Apache server in turn forwards the requests to Airflow webserver as 
HTTP over port 80.  So, in the web browser (I am using Chrome), I access 
Airflow using this URL: https://emp-wf-vkruglik.mydomain.com/admin/  (note the 
https).
   
   However, when I got trough the "Trigger Dag" in Airflow UI and click on the 
Trigger button (or the "abort" button), Airflow GUI attempts to load 
`http://emp-wf-vkruglik.mydomain.com/admin/` instead of 
`https://emp-wf-vkruglik.mydomain.com/admin/`.
   
   From the source code of airflow/www/templates/airflow/trigger.html, I see 
that this incorrect HTTP scheme is picked up from the `{{ origin }}` arg:
   ```
   {% extends "airflow/master.html" %}
   
   {% block body %}
       {{ super() }}
       <h2>Trigger DAG: {{ dag_id }}</h2>
       <form method="POST">
         <input name="csrf_token" type="hidden" value="{{ csrf_token() }}"/>
         <input name="dag_id" type="hidden" value="{{ dag_id }}"/>
         <input name="origin" type="hidden" value="{{ origin }}"/>
         <div class="form-group">
           <label for="conf">Configuration JSON (Optional)</label>
           <textarea class="form-control" name="conf">{{ conf }}</textarea>
         </div>
         <p>
           To access configuration in your DAG use <code>{{ '{{' }} 
dag_run.conf {{ '}}' }}</code>.
         </p>
         <input class="btn btn-primary" type="submit" value="Trigger"/>
         <button class="btn" onclick="location.href = '{{ origin }}'; return 
false">bail.</button>
       </form>
   {% endblock %}
   ```
   
   
   **Anything else we need to know**: Occurs 100%
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to