SSL Problem with google auth - return url is with http:// and not https://

I am trying to login using google auth
The problem is that the return url is with http:// and not https://

The redirect URI in the request,, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit:

I tried to define it like this

config :gym_portal,
       http: [
         port: 4000
       url: [
         host: "",
         port: 443,
         scheme: "https"
       cache_static_manifest: "priv/static/cache_manifest.json"

or like this

force_ssl: [rewrite_on: [:x_forwarded_proto], host: nil]


I am using Nginx with Letsencript

my nginx conf is

upstream sport {
  server localhost:4000 max_fails=5 fail_timeout=60s;

server {

	location / {
		allow all;

# Proxy Headers
		proxy_hide_header X-Frame-Options;
		proxy_http_version 1.1;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header Host $http_host;
		proxy_set_header X-Cluster-Client-Ip $remote_addr;

# The Important Websocket Bits!
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";

		#root /home/eli/sport/priv/static;
		#proxy_redirect    off;
		proxy_pass http://sport;

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


How do you provide callback IRL to Google?

I am using ueberauth_google

I have the same problem in an nginx deployment with Pow Assent trying to use Google OAuth2 with AWS hosting. I can edit the Google callback URL to use http: instead of https: and testing works, but Google won’t allow the OAuth2 consent config to be rolled from test mode to publish mode.