If you're encountering an error on Heroku like "HTTP Origin header (https://example.com) didn't match request.base_url (http://example.com)" with Cloudflare and Heroku integration, it is likely due to a mix of HTTP and HTTPS protocols.
To resolve this issue, follow these steps:
-
Access your Cloudflare account.
-
Navigate to the "Crypto" tab in the Cloudflare dashboard.
-
Under the "SSL" section, locate the "Flexible" option.
-
Change the SSL option from "Flexible" to "Full (Strict)".
By setting the SSL option to "Full (Strict)", Cloudflare will communicate with your Heroku app using HTTPS, ensuring that the Origin header matches the request base URL.
Keep in mind that the solution may vary depending on your specific setup and requirements.