的CloudFlare之前,我是能夠訪問phpMyAdmin的鏈接,如虛擬主機時的CloudFlare啓用
example.com/ctrl/pmasetup
的CloudFlare後不工作,我得到一個403(從我自己的Apache服務器來了,不CloudFlare的錯誤頁)
Forbidden
You don't have permission to access /ctrl/pmasetup on this server.
我覺得我需要的地方添加CloudFlare的反向代理服務器,這是我在/etc/hosts
現在的樣子做了:
127.0.0.1 localhost localhost.localdomain
104.25.68.32 example.com <- This is the ip of my site when CloudFlare is enabled on it
我還添加了它在httpd.conf
在虛擬主機配置:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/example.com
ServerName example.com
ErrorLog logs/example.com-error_log
CustomLog logs/example.com-access_log combinedio
Alias /ctrl /var/www/ctrl
<Location /ctrl>
<RequireAny>
Require all denied
Require ip {my ip}
Require ip 104.25.68.32 <- CloudFlare IP, again
</RequireAny>
</Location>
#Header always set Access-Control-Allow-Origin "http://example.com"
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "*"
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
</VirtualHost>
編輯:註釋整個RequireAny
塊即使,我仍然獲得了403啓用CloudFlare的時候。編輯2:如果在location
標籤內我只有Require all granted
,那麼它就可以工作。所以,我怎麼可以禁止所有人,但一些IP的我把最初?
編輯3:這很可能是因爲CloudFlare更改您的IP作爲訪問者,然後我的apache配置無法識別它。任何想法?
安裝[mod_cloudflare](https://www.cloudflare.com/technical-resources/#mod_cloudflare),保留舊的工作規則。要知道,如果他們加入到範圍泰斯更新你的配置[IPS](https://www.cloudflare.com/ips/) – Wrikken
...如果你不能夠安裝mod_cloudflare,檢查'CF連接-IP'頭而不是,但對於_only_如果'REMOTE_ADDR'是在範圍爲每IP頁面,所以要準備創造了很多的規則(你可以建立一個巨大的'RewriteCond'對一個禁止'名單。RewriteRule' – Wrikken