blonestar / wp-theme-vite-tailwind

Wordpress + ViteJS + TailwindCSS development example theme, similar to Tailpress but without additional code added
GNU General Public License v3.0
337 stars 57 forks source link

Insecure content #1

Closed cabbbbage closed 3 years ago

cabbbbage commented 3 years ago

[blocked] The page at https://mydomain.com/ was not allowed to run insecure content from http://localhost:3000/main.js.

Hi! This theme is looking very interesting. How should I fix this? Nothing is loading, just plain text. This happens only after npm run dev and if this is set to true: define('IS_VITE_DEVELOPMENT', true);

blonestar commented 3 years ago

Hi @kkemila, Please pull the latest version, I've just added https=true option to the vite.config.js and update packages to the latest. Note: run npm install after pulling from the repo Thanks for trying the theme and reporting the issue, and please let me know does it solve the problem. :)

blonestar commented 3 years ago

One more thing... Please edit functions.php and set VITE_SERVER to httpS also, I missed that in this push. define('VITE_SERVER', 'https://localhost:3000');

blonestar commented 3 years ago

Actually it seams a bit deeper problem. I just tested and figure out browser not allowing connection to the Vite dev server via httpS without certificate. Will try to find solution. In the mean time I recommend reverting all settings (and yoursitedomain.local) to http not httpS, and everything should work fine.

blonestar commented 3 years ago

I've added solution tips in latest version. Basically certificate need to be generated for serving Vite localhost dev and properly configured. I did test but please let me know does it work for you. Thanks

From readme.md

If your local development domain is served via https:// then generating certificate for localhost usage and some changes in config are required

# install mkcert
choco install mkcert

# global one time install
mkcert -install

# run in project/theme folder to create localhost-key.pem & localhost.pem 
mkcert localhost
blonestar commented 3 years ago

So https will work with a certificate like described above, I will close it.