This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

netm
netm

Hi there, does anyone in OctoberCMS land know how to make the |theme filter work well with SSL ? So the following, for instance, would output the url starting with https?

{{ 'assets/images/favicon.png'|theme }}
dshoreman
dshoreman

First thing to check is the url setting in config/app.php. If that starts with http://, it could be influencing how asset URLs get generated.

Secondly, in config/cms.php you can try setting linkPolicy to either "secure" or "force". The latter will make sure it fully matches the URL setting from config/app.php.

Last updated

Eoler
Eoler

First thing to check is the url setting in config/app.php. If that starts with http://, it could be influencing how asset URLs get generated. Secondly, in config/cms.php you can try setting linkPolicy to either "secure" or "force". The latter will make sure it fully matches the URL setting from config/app.php.

I converted test subdomain with payment gateway yesterday by:

  • changing linkPolicy to force
  • prefixing app.url config with https://

It works great, and still allows Vagrant development on "insecure" local domain by adjusting local app.url to http:// and commenting out force secure connection rewrite block in .htaccess

ctamayo22635
ctamayo22635

I'm late to the party, but still pertinent: this is a great use-case for environment variables. This approach lets you declare different configurations across environments (e.g. your local Vagrant install vs production) without having to modify .htaccess and risk committing/deploying such a change.

The relevant parts of my local .env file look like:

APP_URL=http://localhost:8004
LINK_POLICY=detect

You can get these values in your config files using the env() function. For example in cms.php:

    'linkPolicy' => env('LINK_POLICY', 'secure'),

The second argument is optional and specifies a default value in case it's not set in the current environment. It's probably a good idea to set the default to whatever the value should be in production.

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.