Admin log-in loop when domain go throgh CloudFront CDN

System Information
  • Strapi Version: 4.11.7
  • Operating System: Rocky Linux
  • Database: Postgres
  • Node Version: 18.17.0
  • NPM Version: 9.8.1
  • Yarn Version: 1.22.19

When we make our domain point to CloudFront that proxies requests to our server, we can’t login to admin anymore, one we type email and password, then click the submit button, it first seems like login was successful, then it redirects back to the login page. The only errors shown in the console is 401 for the following pages:

  • /information
  • /permissions
  • /me

When we make the domain point directly to our server, we then can login with no issues.
In all cases, we use Nginx that pass requests to the actual Strapi server through proxy_pass.

Is there and settings we need to tweak on Strapi? Or is there any headers/settings need to be added on the CDN service?

Our plan was to go online yesterday, but is a showstopper and cannot go online until we fix it.

Any help is appreciated.

1 Like

Im currently having the same issue. Ive disabled all cacheing for the cf origin temporarily (it was actually my intention to cache nothing exception for some specific api paths) but the same issue still remains.

Did you find a solution?

This seems to be a fairly high ranking thread on google.
The solution is inculdeing an extra header in your CF origin policy.
Thank you to ‘LundTech’ in this thread: