본문 바로가기

Server Dev

Cloudflare 방화벽 문제 해결 User-Agent

현재 DNS와 무료 SSL이유로 Cloudflare를 사용하고 있다.

PG 연동 관련해서 카드 승인 체크 callback API 호출시 자꾸 에러가 발생하였다.

일반결제로 ISP(페이북)결제를 사용하고 있는데...

ISP -> Cloudflare(proxy) -> callback Server

이렇게 되다보니 Cloudflare에서 기본적으로 막아주고 있는 정책덕에 통신이 안되는 문제가 생겼다.

어떤것때문에 막히나 확인해보니 ISP에서 callback Server쪽으로 통신을할때 user-agent값이 "Java/1.6.0" 이었다.

이걸 Cloudflare에서 막고있었다.

그래서 Java가 포함되면 허용되도록 Cloudflare Admin Console에서 설정하고 나니 잘된다.

 

추가적으로 callback Server에서 Nginx에서 nginx.config 설정파일 Server 블록부분에 아래 내용도 넣어주었다.

types { } default_type "application/xml; charset=euc-kr;";

개발 이외에 챙겨야할 인프라적 세팅이 필요하다...

 

 

참고1 : https://support.cloudflare.com/hc/en-us/articles/115002059131-What-are-my-options-for-protecting-my-site-#h_304979181631517851857106

 

What are my options for protecting my site?

Cloudflare offers a number of tools for controlling your traffic, thereby protecting your domains, URLs, and directories against specified volumes of traffic, certain groups of requesters, and spec...

support.cloudflare.com

참고2 : https://support.cloudflare.com/hc/en-us/articles/115001856951-How-do-I-block-malicious-User-Agents-with-Cloudflare-

 

How do I block malicious User-Agents with Cloudflare?

User-Agent (UA) Rules User Agent rules match against the User-Agent request header sent by the browser or application accessing your site. UA rules are applied against the entire domain. Wildcards ...

support.cloudflare.com

참고2 : https://www.cyberciti.biz/faq/how-to-override-content-type-with-nginx-web-server/

 

How to override content type with Nginx web server - nixCraft

This page explains how to override content type with Nginx web server and verify it with curl command on Linux or Unix-like systems.

www.cyberciti.biz