Replace "http" to "https" in Example API Calls

I created a self-hosted redash instance on AWS and enabled SSL.
I can already connect the instance via https.
However, the URLs displayed in the example API call section begin with “http://” instead of “https://”.

how can I replace “http” to “https” in Example API Calls?
I want to prevent non-technical staff from making mistakes.

1 Like

Welcome to the forum! This ought to happen automatically, since the API call URL’s on the query screen are generated using Flask’s built-in url_for function. How did you enable SSL?

Thanks for your reply!

【The steps I enabled SSL】
After creating an instance using the official AMI(ami-060741a96307668be), I ran the following article.

In brief, There are follows three steps.
step1. Create nginx.conf
step2. Change nginx image configuration in docker-compose.yml to use nginx.conf of step1
step3. Run the certbot command

Is there some environment variable that you forgot to change?

Got it thanks. When you see the http example calls on the query screen, are you visiting with https? Flask should automatically pick up the protocol scheme from the browser request. So if you visit https then all its URLs will be https also. But if you visit from http they will be http.

Typically you’ll enforce an nginx rule that redirects all http traffic to https.

When you see the http example calls on the query screen, are you visiting with https ?

Yes, I am visiting via https. I have attached a screenshot.

Typically you’ll enforce an nginx rule that redirects all http traffic to https .

Already set up.Some of the specifications in nginx.conf are as follows.

server {
    listen      80;
    listen [::]:80;
    server_name redash.my.domain;

    location / {
        rewrite ^ https://$host$request_uri? permanent;
    }

}

By the way, the version of redash is v8.0.0, as the AMI provided by AWS is still v8.

Regarding V8: you can upgrade your existing installation to V10 quite easily. We strongly recommend this as V8 is no longer supported and there are CVE’s which have been patched already in V10.


After that, I wonder if modifying this line to include x_proto=1 will fix the issue. I’m getting that by looking at the Werkzeug documentation for ProxyFix. By default, it won’t honour the protocol setting passed in from nginx which may be the root cause of the issue. Although it’s strange we haven’t seen this issue crop up in the past.

Regarding V8: you can upgrade your existing installation to V10 quite easily. We strongly recommend this as V8 is no longer supported and there are CVE’s which have been patched already in V10.

Thank you, I have updated to v10.1.0.
I had just built the environment and forgot to update.

After that, I wonder if modifying this line 2 to include x_proto=1 will fix the issue.

I have tried adding it, but the result seems to be the same.
I will post a screenshot.

Reading the Werkzeug documentation for ProxyFix, the default value of x_proto is 1.
I guess the behavior is the same without specifying it.

Thanks. Can you try setting the REDASH_HOST environment variable to the base url for your instance?

Something like:

export REDASH_HOST=https://redash.some-domain.tld

You’ll need to restart your containers for this change to take effect.

I restarted the redash server after putting REDASH_HOST in the /opt/redash/env,
but there was no change in the display.

It seems certain that the environment variable is reflected.

/opt/redash$ sudo docker-compose exec server /bin/bash
redash@xxxxx:/app$ echo $REDASH_HOST
https://redash.my.domain