CloudFlare 환경과 적용에 대한 코드 다시 재수정

This commit is contained in:
thisgun
2024-11-04 16:13:43 +09:00
parent 29381da2ce
commit d65fa99e3c
8 changed files with 14 additions and 9 deletions

View File

@ -1,8 +1,6 @@
<?php
if (!defined('_GNUBOARD_')) exit;
// CloudFlare를 사용시, 사용자 환경에 맞는 $_SERVER['REMOTE_ADDR']과 $_SERVER['HTTPS'] 사용 여부를 수정합니다.
class G5CheckCloudFlare {
class G5CloudflareRequestHandler {
public static function check_cloudflare_ips($user_ip){
// 클라우드플레어 IP, https://www.cloudflare.com/ips
@ -100,7 +98,7 @@ class G5CheckCloudFlare {
}
}
if ($_SERVER['HTTP_CF_CONNECTING_IP'] && G5CheckCloudFlare::check_cloudflare_ips($_SERVER['REMOTE_ADDR'])) {
if ($_SERVER['HTTP_CF_CONNECTING_IP'] && G5CloudflareRequestHandler::check_cloudflare_ips($_SERVER['REMOTE_ADDR'])) {
$_SERVER['REMOTE_ADDR'] = preg_replace('/[^0-9a-fA-F:.]/', '', $_SERVER['HTTP_CF_CONNECTING_IP']);
// Cloudflare 환경을 고려한 https 사용여부

View File

@ -29,6 +29,10 @@ for ($i=0; $i<$ext_cnt; $i++) {
}
//==========================================================================================================================
// Cloudflare 사용시 REMOTE_ADDR 에 사용자 IP 적용과 https 사용 여부
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
include_once('cloudflare.check.php'); // cloudflare 의 ip 대역인지 체크
}
function g5_path()
{

View File

@ -234,10 +234,5 @@ define('G5_VISIT_BROWSCAP_USE', false);
*/
define('G5_IP_DISPLAY', '\\1.♡.\\3.\\4');
// Cloudflare 사용시 REMOTE_ADDR 에 사용자 IP 적용과 https 사용 여부
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
include_once(G5_LIB_PATH.'/cloudflare.lib.php'); // cloudflare 의 ip 대역인지 체크
}
// KAKAO 우편번호 서비스 CDN
define('G5_POSTCODE_JS', '<script src="//t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js" async></script>');

View File

@ -1,5 +1,6 @@
<?php
$g5_path['path'] = '..';
include_once('install_common.php');
include_once('../config.php');
include_once('./install.function.php'); // 인스톨 과정 함수 모음
include_once('../lib/common.lib.php'); // 공통 라이브러리

View File

@ -2,6 +2,7 @@
@header('Content-Type: text/html; charset=utf-8');
@header('X-Robots-Tag: noindex');
$g5_path['path'] = '..';
include_once('install_common.php');
include_once ('../config.php');
$title = G5_VERSION." 라이센스 확인 1/3";
include_once ('./install.inc.php');

View File

@ -0,0 +1,4 @@
<?php
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
include_once('../cloudflare.check.php'); // cloudflare 의 ip 대역인지 체크
}

View File

@ -9,6 +9,7 @@ header('Pragma: no-cache'); // HTTP/1.0
@header('X-Robots-Tag: noindex');
$g5_path['path'] = '..';
include_once('install_common.php');
include_once ('../config.php');
$title = G5_VERSION." 초기환경설정 2/3";
include_once ('./install.inc.php');

View File

@ -10,6 +10,7 @@ header('Pragma: no-cache'); // HTTP/1.0
@header('X-Robots-Tag: noindex');
$g5_path['path'] = '..';
include_once('install_common.php');
include_once('../config.php');
include_once('../lib/common.lib.php');
include_once('./install.function.php'); // 인스톨 과정 함수 모음