Use caddy 2.0 to build a reverse proxy for Disqus API. The URL of the API is:https://disqus.com/api/。
-
setup reverse_proxy
1 2 3
reverse_proxy https://disqus.com { header_up Host {upstream_hostport} }
-
setup rewrite
1
rewrite * /api{path}
This step is because it needs to be forwarded to the api path。
-
setup disqus
websit:https://disqus.com/api/applications/***. Add the domain name of the reverse proxy server toDomains
。 -
Verify reverse proxy
Verify whether the proxy setting is successful. You can access the proxy through a browser and check whether it will jump to this URL https://disqus.com/api/docs/。 -
Complete example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
www.example.com, :666 { tls ***@*mail.com rewrite * /api{path} reverse_proxy https://disqus.com { header_up Host {upstream_hostport} # header_up User-Custom-Domain {host} # header_down Access-Control-Allow-Origin https://www.example.com # header_down Access-Control-Allow-Credentials=true # health_timeout 5s # transport http { # tls # } } # log { # output file /var/log/caddy/access.log # } }