Properly add response headers for CORS
This commit is contained in:
parent
74c5ec70a9
commit
3f6ea04048
8 changed files with 198 additions and 138 deletions
|
@ -8,18 +8,3 @@
|
|||
[entryPoints]
|
||||
[entryPoints.web]
|
||||
address = ":8000"
|
||||
|
||||
[providers]
|
||||
[providers.file]
|
||||
|
||||
## dynamic configuration ##
|
||||
|
||||
[http.routers]
|
||||
[http.routers.router1]
|
||||
rule = "Host(`test.localhost`)"
|
||||
service = "service1"
|
||||
|
||||
[http.services]
|
||||
[http.services.service1.loadBalancer]
|
||||
[[http.services.service1.loadBalancer.servers]]
|
||||
url = "http://172.17.0.2:80"
|
||||
|
|
|
@ -17,6 +17,12 @@
|
|||
[http.routers]
|
||||
[http.routers.router1]
|
||||
rule = "Host(`test.localhost`)"
|
||||
middlewares = ["cors"]
|
||||
service = "service1"
|
||||
|
||||
[http.routers.router2]
|
||||
rule = "Host(`test2.localhost`)"
|
||||
middlewares = ["nocors"]
|
||||
service = "service1"
|
||||
|
||||
[http.middlewares]
|
||||
|
@ -26,7 +32,11 @@
|
|||
accessControlMaxAge = 100
|
||||
addVaryHeader = true
|
||||
|
||||
[http.middlewares.nocors.Headers]
|
||||
[http.middlewares.nocors.Headers.CustomResponseHeaders]
|
||||
X-Custom-Response-Header = "True"
|
||||
|
||||
[http.services]
|
||||
[http.services.service1.loadBalancer]
|
||||
[[http.services.service1.loadBalancer.servers]]
|
||||
url = "http://172.17.0.2:80"
|
||||
url = "http://127.0.0.1:9000"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue