:tocdepth: 3 :py:mod:`gws.base.web.site` =========================== .. py:module:: gws.base.web.site **Source code:** :source:`gws.base.web.site` Module Contents --------------- .. py:class:: Config(*args, **kwargs) Bases: :py:obj:`gws.Config` Site (virtual host) configuration .. py:attribute:: assets :type: Optional[WebDocumentRootConfig] Root directory for assets. .. py:attribute:: canonicalHost :type: str :value: '' Hostname for reversed URL rewriting. .. py:attribute:: contentSecurityPolicy :type: str :value: "default-src 'self'; img-src * data: blob:" Content Security Policy for this site. (added in 8.1) .. py:attribute:: cors :type: Optional[CorsConfig] Cors configuration. .. py:attribute:: errorPage :type: Optional[gws.ext.config.template] Error page template. .. py:attribute:: host :type: str :value: '*' Host name. .. py:attribute:: permissionsPolicy :type: str :value: 'geolocation=(self), camera=(), microphone=()' Permissions Policy for this site. (added in 8.1) .. py:attribute:: rewrite :type: Optional[list[RewriteRuleConfig]] Rewrite rules. .. py:attribute:: root :type: WebDocumentRootConfig Root directory for static documents. .. py:class:: CorsConfig(*args, **kwargs) Bases: :py:obj:`gws.Config` CORS configuration. .. py:attribute:: allowCredentials :type: bool :value: False Access-Control-Allow-Credentials header. .. py:attribute:: allowHeaders :type: str :value: '' Access-Control-Allow-Headers header. .. py:attribute:: allowMethods :type: str :value: '' Access-Control-Allow-Methods header. .. py:attribute:: allowOrigin :type: str :value: '' Access-Control-Allow-Origin header. .. py:attribute:: maxAge :type: int :value: 5 Access-Control-Max-Age header. .. py:class:: Object Bases: :py:obj:`gws.WebSite` Web site. .. py:attribute:: canonicalHost :type: str .. py:attribute:: contentSecurityPolicy :type: str .. py:attribute:: permissionsPolicy :type: str .. py:attribute:: ssl :type: bool .. py:method:: configure() Configuration hook. .. py:method:: url_for(req, path, **params) Rewrite a request path to an Url. :param req: Web Requester. :param path: Raw request path. :param \*\*kwargs: Extra GET params. :returns: A rewritten URL. .. py:class:: RewriteRuleConfig(*args, **kwargs) Bases: :py:obj:`gws.Config` Rewrite rule configuration. .. py:attribute:: options :type: Optional[dict] Additional options. .. py:attribute:: pattern :type: gws.Regex Expression to match the url against. .. py:attribute:: reversed :type: bool :value: False Reversed rewrite rule. .. py:attribute:: target :type: str Target url with placeholders. .. py:class:: SSLConfig(*args, **kwargs) Bases: :py:obj:`gws.Config` SSL configuration. .. py:attribute:: crt :type: gws.FilePath Crt bundle location. .. py:attribute:: hsts :type: gws.Duration :value: '365d' HSTS max age. (added in 8.1) .. py:attribute:: key :type: gws.FilePath Key file location. .. py:class:: WebDocumentRootConfig(*args, **kwargs) Bases: :py:obj:`gws.Config` Web-accessible directory. .. py:attribute:: allowMime :type: Optional[list[str]] Allowed mime types. .. py:attribute:: denyMime :type: Optional[list[str]] Disallowed mime types (from the standard list). .. py:attribute:: dir :type: gws.DirPath Directory path.