I am using Mayan EDMS in Docker behind a NGINX proxy and access it using https. When I am using the API to get the documents the APi returns a "next" URL starting with http. So the result looks like this:
I already tried to fix it by settings "proxy_set_header X-Forwarded-Proto $scheme;" in NGINX config. Is there a possibility to get the URL with the correct scheme?
walnuss0815 wrote: ↑Tue Dec 15, 2020 8:01 pm
I already tried to fix it by settings "proxy_set_header X-Forwarded-Proto $scheme;" in NGINX config. Is there a possibility to get the URL with the correct scheme?
I independently added that as feature request to the gitlab issues and it was closed immediately but I got the general answer "Specify project url with https scheme in COMMON_PROJECT_URL variable." from Ilya Pavlov.
Sadly the manual does not give an example what is expected there as neither "https" nor "https://", "https://my.site.com", "https://my.site.com/" or "https://my.site.com:443/" resulted in anything but an empty page or an error. But that variable should do the trick.
def __url_fixup (self, url):
"""
At the moment all returned URLs from Mayan will use the "http" scheme and there is no parameter permitting to change that
This function will return a URL with the scheme that was selected during intialization of the connection object.
"""
if url:
url_decomposed = urlparse (url)
new_url = url_decomposed._replace ("https")
return urlunparse (new_url)
else:
return None
walnuss0815 wrote: ↑Tue Dec 15, 2020 8:01 pm
I already tried to fix it by settings "proxy_set_header X-Forwarded-Proto $scheme;" in NGINX config. Is there a possibility to get the URL with the correct scheme?
I independently added that as feature request to the gitlab issues and it was closed immediately but I got the general answer "Specify project url with https scheme in COMMON_PROJECT_URL variable." from Ilya Pavlov.
My bad, this variable has nothing to do with API scheme. But there are Django own setting SECURE_PROXY_SSL_HEADER.