@Martin @caniwi @wthess @sebi @lilarcor @holantomas @daniel.pan @Andrew_Powell
Issue solved, following this post https://blog.ubuntu.com/2015/08/18/django-behind-a-proxy-fixing-absolute-urls
There are two steps, without need to change any source code.
- The apache configuration (seahub section):
#
# seahub
#
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
RequestHeader set X-Forwarded-Proto 'https' env=HTTPS
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
- Add these two lines to seahub_setting.py in the conf folder
USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
By the way, I would suggest to change the default values of USE_X_FORWARDED_HOST and SECURE_PROXY_SSL_HEADER in Django for the next-version of Seafile, so that the user doesn’t have to change the seahub_setting.py. The apache configuration in the document is also needed to update.