Redirect /login to /auth/ldap

AI-generated summary

The discussion revolves around customizing the login process for a Discourse instance that uses LDAP authentication. Tomas_Hnyk wants to automatically redirect users from the /login page to /auth/ldap/, as the former doesn’t provide any value in their use case. Alexander mentions that Discourse has an “auth immediately” setting, but it doesn’t affect the /login page. Tomas_Hnyk found a workaround by adding a permanent redirect rule to their nginx configuration file (redirect.conf).

We support only one login method via LDAP. Currently, when user logs out, he is sent to page our.domain/login which looks like this (screenshot from my test server in virtualbox, hence the url and https warning):

Clicking on log in sends the user to our.domain/auth/ldap/:slight_smile:

Is there a way to make this redirect automatic so user would never see the first screen (which in our use case does not bring any value)?

(a bonus question would be how to customize the latter screen to include a link for password reset)

Edit: clearly I am not the only one interested: Custom login permalink

Discourse has a setting to automatically redirect to external provider, but it doesn’t affect the ‘/login’ page since it’s a “static” page.

I think is auth immediately

In the end I put this:

# Permanent redirect to an individual page
rewrite ^/login$ http://mydomain.tld/auth/ldap permanent;

to
/etc/nginx/conf.d/mydomain.tld.d/redirect.conf

I am running Discourse on Yunohost, so it is run through nginx. Would be nice if Discourse did this automatically:-).