Production assets are coming in as HTTP instead of HTTPS

Going crazy looking for a reason why assets are coming in as HTTP.

Set the following:


devUrl and proxyUrl are set to use HTTPS

yarn build:production
assets are found and added to dist/assets.json

But any use of @asset() or App\asset_path() in theme files returns HTTP. ie img src

Am I missing something?

Hi Ian. I’m a bit confused. Which environment is this error occurring in?

WP_ENV=production and yarn build:production imply a production (remote) server, but devUrl and proxyUrl imply development (local) server.

Can you tell us a little bit about your server environment? If it’s local development, are you using Trellis, VVV, Vagrant, Valet, MAMP, Local, etc.?

I thought your issue could be related to:

But I tested it locally (Valet) (pre/post this merge, i.e. 9.0.0 vs. 9.0.1) and could not replicate your issue.

Thanks for quick reply.

Yes, this is in the production environment

If this is occurring in a production environment then I don’t think it’s an issue with Sage. It’s either the server environment or the application (WordPress/Bedrock).

In Sage, asset_path() (and its @asset directive) both use get_theme_file_uri(). What is WP_SITEURL set to? It seems to me that that’d be the relevant option in WordPress.

1 Like

Thanks. You were right!

It was related to Bedrock environment config. Thanks again for the quick reply.