skip to Main Content

i have installed wordpress and i’ve set SSL (LetsEncrypt).
It works fine since few months.
Now i want to add Varnish to speed up site and i have one issue.
My config is:
MyPage.com (443) -> Varnish (80) -> MyPage (8080) no https.
When i open page, everything is OK
besides address to static files.
All URL’s to CSS, JS, Images are served as HTTP, NOT HTTPS.
That is because in the end page is served by Apache without SSL.
Do you know how to change address to static files, that they will be served as HTTPS (https://MyPage.com/my.js instead of http://MyPage.com/my.js)?

2

Answers


  1. WordPress save the links absolutly in the database.
    Soloution 1:
    You edit all entries in the Database
    Soloution 2:
    Simple use this Plugin to write all urlĀ“s in the database from http to https:

    https://de.wordpress.org/plugins/really-simple-ssl/

    Login or Signup to reply.
  2. You might need to make sure the X-Forwarded-Proto header is set and passed all the way back through Varnish to the backend.

    Assuming you have Apache:443 -> Varnish:80 -> Backend:8080

    Then in the Apache config that is handling the https add the following to the VirtualHost

    RequestHeader set X-Forwarded-Proto "https"

    Varnish should forward this by default, unless you have done anything custom to the config that might prevent it.

    This header should then be respected and used to set the protocol on the urls for assets.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search