Project

General

Profile

How do I solve the CORS problem? » lighttpd.conf

my lighttpd config file - SeungHyun Park, 2020-04-09 01:31

 
1
server.modules = (
2
	"mod_access",
3
    "mod_auth",
4
	"mod_alias",
5
	"mod_compress",
6
    "mod_accesslog",
7
    "mod_fastcgi",
8
    "mod_setenv",
9
#    "mod_rewrite",
10
# 	"mod_redirect",
11
    "mod_proxy",
12
    "mod_status",
13
)
14

    
15
server.document-root        = "/var/www/html"
16
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
17
server.errorlog             = "/var/log/lighttpd/error.log"
18
server.pid-file             = "/var/run/lighttpd.pid"
19
server.username             = "www-data"
20
server.groupname            = "www-data"
21
server.port                 = 80
22

    
23
#setenv.add-response-header  = ( "Access-Control-Allow-Origin" => "*" )
24
# CORS Headers
25
setenv.add-response-header = (
26
        "Access-Control-Allow-Origin" => "*",
27
        "Access-Control-Allow-Credentials" => "true",
28
        "Access-Control-Allow-Headers" => "accept, origin, x-requested-with, content-type, x-transmission-session-id",
29
        "Access-Control-Expose-Headers" => "X-Transmission-Session-Id",
30
        "X-Proxy" => "www-02",
31
        "Access-Control-Allow-Methods" => "GET, PUT, POST, HEAD, DELETE, OPTIONS"
32
)
33

    
34
# strict parsing and normalization of URL for consistency and security
35
# https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_http-parseoptsDetails
36
# (might need to explicitly set "url-path-2f-decode" = "disable"
37
#  if a specific application is encoding URLs inside url-path)
38
server.http-parseopts = (
39
  "header-strict"           => "enable",# default
40
  "host-strict"             => "enable",# default
41
  "host-normalize"          => "enable",# default
42
  "url-normalize-unreserved"=> "enable",# recommended highly
43
  "url-normalize-required"  => "enable",# recommended
44
  "url-ctrls-reject"        => "enable",# recommended
45
  "url-path-2f-decode"      => "enable",# recommended highly (unless breaks app)
46
 #"url-path-2f-reject"      => "enable",
47
  "url-path-dotseg-remove"  => "enable",# recommended highly (unless breaks app)
48
 #"url-path-dotseg-reject"  => "enable",
49
 #"url-query-20-plus"       => "enable",# consistency in query string
50
)
51

    
52
index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
53
url.access-deny             = ( "~", ".inc" )
54

    
55
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
56

    
57
compress.cache-dir          = "/var/cache/lighttpd/compress/"
58
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )
59

    
60
# default listening port for IPv6 falls back to the IPv4 port
61
## Use ipv6 if available
62
#include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
63
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
64
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
(1-1/2)