XDN is converting my site’s relative paths in redirect into absolute paths. This is breaking login on my site which is excluded from the cache

On site, the login link on /login.php has a redirect that’s being converted to https://www.test.com/login.php. This is breaking login. What’s really odd is that this URL is excluded from the caching rules in the router so not sure why this is happening.

It turns out the project had a redirect URL hardcoded and it was hardcoded to our pre-prod URL.

Staging / production specific URLs should be stored in environment variables for this reason. In this case, the redirect URL needed to be in a environment variable and router code changed to reference the variable like so

updateResponseHeader('location', /[www.test.com/](http://www.test.com/), process.env.REQUEST_DOMAIN)

Check https://developer.moovweb.com/guides/environments#section_environment_variables for more details on how to use environment variables.

1 Like