If you install Piwik, connecting through a reverse proxy (https-to-http), the following line should be automatically added to your config/config.ini.php file during the Piwik installation:

[General]
assume_secure_protocol = 1

If you install Piwik from behind the reverse proxy (where Piwik can’t detect https will be used), you should set the above manually. Also, depending on your proxy server, the Visitor IP is set in a different HTTP Header which should also be automatically detected on install and added to your config/config.ini.php:

[General]
; Uncomment line below if you use a standard proxy
;proxy_client_headers[] = HTTP_X_FORWARDED_FOR
;proxy_host_headers[] = HTTP_X_FORWARDED_HOST

; Uncomment line below if you use CloudFlare
;proxy_client_headers[] = HTTP_CF_CONNECTING_IP

; Uncomment line below if you use another proxy (that sets Client-IP header)
;proxy_client_headers[] = HTTP_CLIENT_IP

If Piwik was unable to detect your proxy configuration, you may add these lines manually in your Piwik config.ini.php file (remove the leading “;” character to enable the setting).

If your server is configured behind an outgoing proxy, check out this FAQ: outgoing Proxy easy setup in Piwik. You might also be interested in How do I force Piwik login to use SSL (https)?.