Can’t connect to postgresql database with SSL using GSSAPI

With postgresql 12.4, I’ve got this in pg_hba.conf:

hostssl all all gss map=myrealm 

but whenever I try to connect with:

psql 'postgresql://hostname/database?sslmode=require' 

I get

2020-11-26 16:03:37.934 GMT [9585] FATAL:  no pg_hba.conf entry for host "", user "username", database "database", SSL off 

If I replace hostssl with host I can connect (with GSSAPI).

How do I get psql to connect with SSL? I have ssl = on in my postgresql.conf and I have valid server.crt and server.key in the PGDATA directory.