瀏覽代碼

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

version-14
Anand Doshi 9 年之前
父節點
當前提交
957048457d
共有 1 個檔案被更改,包括 13 行新增1 行删除
  1. +13
    -1
      frappe/utils/data.py

+ 13
- 1
frappe/utils/data.py 查看文件

@@ -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:
protocol = 'https' == frappe.get_request_header('X-Forwarded-Proto', "") and 'https://' or 'http://'
host_name = protocol + frappe.local.request.host

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:
host_name = frappe.db.get_value("Website Settings", "Website Settings",
"subdomain")


Loading…
取消
儲存