Sfoglia il codice sorgente

[fix] get https url if ssl certificate is present or wildcard domain match

version-14
Anand Doshi 9 anni fa
parent
commit
957048457d
1 ha cambiato i file con 13 aggiunte e 1 eliminazioni
  1. +13
    -1
      frappe/utils/data.py

+ 13
- 1
frappe/utils/data.py Vedi File

@@ -568,8 +568,20 @@ def get_url(uri=None, full_address=False):
if hasattr(frappe.local, "request") and frappe.local.request and frappe.local.request.host: if hasattr(frappe.local, "request") and frappe.local.request and frappe.local.request.host:
protocol = 'https' == frappe.get_request_header('X-Forwarded-Proto', "") and 'https://' or 'http://' protocol = 'https' == frappe.get_request_header('X-Forwarded-Proto', "") and 'https://' or 'http://'
host_name = protocol + frappe.local.request.host host_name = protocol + frappe.local.request.host

elif frappe.local.site: elif frappe.local.site:
host_name = "http://{}".format(frappe.local.site)
protocol = 'http://'

if frappe.local.conf.ssl_certificate:
protocol = 'https://'

elif frappe.local.conf.wildcard:
domain = frappe.local.conf.wildcard.get('domain')
if domain and frappe.local.site.endswith(domain) and frappe.local.conf.wildcard.get('ssl_certificate'):
protocol = 'https://'

host_name = protocol + frappe.local.site

else: else:
host_name = frappe.db.get_value("Website Settings", "Website Settings", host_name = frappe.db.get_value("Website Settings", "Website Settings",
"subdomain") "subdomain")


Caricamento…
Annulla
Salva