###参考https://veggiespam.com/headers/
###nginx作为反向代理
# Redirect 80 --> 443
server {
listen 80;
listen [::]:80;
server_name veggiespam.com www.veggiespam.com;
return 301 https://$host$request_uri;
}
# HTTPS proxies to local instance
server {
listen 443;
listen [::]:443;
server_name veggiespam.com www.veggiespam.com
# Put TLS configuration here
location / {
proxy_pass http://localhost:4567;
proxy_pass_header Set-Cookie;
proxy_redirect off;
proxy_set_header Accept-Encoding '';
proxy_set_header Referer $http_referer;
proxy_set_header Host $host;
proxy_http_version 1.1;
# Remove Headers begin
proxy_hide_header X-Powered-By;
proxy_hide_header Server;
proxy_hide_header X-AspNetMvc-Version;
proxy_hide_header X-AspNet-Version;
# end Remove Headers
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_no_cache $http_pragma $http_authorization;
proxy_cache_bypass $http_pragma $http_authorization;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404;
}
}
###Apache作为反向代理
<VirtualHost *:80>
ServerName www.veggiespam.com
ServerAdmin evil-kitten@veggiespam.com
ProxyRequests Off
ProxyPreserveHost Off
AllowEncodedSlashes On
KeepAlive Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
# Remove Headers begin
Header unset X-Powered-By
Header unset Server
Header unset X-AspNetMvc-Version
Header unset X-AspNet-Version
# end Remove Headers
ProxyPass / http://localhost:5984/ example
ProxyPassReverse / http://localhost:5984/
</VirtualHost>