How to use specific URL on mailgun adapter, instead of auto-use of parse server's public URL?

This is my setup;

var api = new ParseServer({
    publicServerURL: `http://localhost:1337/parse`,

    emailAdapter: {
        module: '@parse/simple-mailgun-adapter',
        options: {
            fromAddress: '[email protected]',
            domain: '[email protected]',
            apiKey: '',
        }
    }
})

Now, because I’m using a load balancer that forwards traffic between 3 parse servers, I want to keep using localhost as my server URL, so when the time comes and I need to add another parse server, I can do it from a snapshot of this server without the need to configure anything!

The thing is when a user requests a password reset, it obviously fails because part of the link is localhost. My question is, is it possible to somehow redirect that request to another parse server?

Your public url should be loadbalancer.yourdomain.com or whatever you are using to connect load balancer. This way you can use your domain as URL and load balancer will redirect it to one of the parse servers.

2 Likes

Worked like a charm! I have another question about mailgun, which I hope you could help me with… The link for the password reset that comes in the email, looks like this; https://lb-fra1.np-srv.me/parse/apps/applicationId/request_password_reset?token=token&username=vlademort

Is there any way to conceal the applicationId? Could that pose a security threat?

I don’t think so. ApplicationId doesn’t provide additional security and it’s already exposed on client apps or website.

1 Like