中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

中國站
幫助中心 > 安全 > 高防IP > 常見問題 > 高防IP回源字段參考

高防IP回源字段參考

回源服務器地址為IP格式

配置

獲取請求頭方法

以PHP為例。

  1. <?
  2. print_r($_SERVER);
  3. ?>

以SpringBoot(Java)為例。

  1. @RestController
  2. public class TestController {
  3. @GetMapping("/test")
  4. public String test(HttpServletRequest request) {
  5. Enumeration headerNames = request.getHeaderNames();
  6. while (headerNames.hasMoreElements()) {
  7. String headerName = headerNames.nextElement();
  8. String headerValue = request.getHeader(headerName);
  9. System.out.println(headerName + ":" + headerValue);
  10. }
  11. return "success";
  12. }
  13. }
  1. 源服務器未使用代理轉發該端口的請求(如沒有使用nginx轉發端口請求)。
    http協議 請求的字段

    1. array(10) {
    2. ["request_method"]=>
    3. string(3) "GET"
    4. ["request_uri"]=>
    5. string(1) "/"
    6. ["path_info"]=>
    7. string(1) "/"
    8. ["request_time"]=>
    9. int(1613802357)
    10. ["request_time_float"]=>
    11. float(1613802357.2114)
    12. ["server_protocol"]=>
    13. string(8) "HTTP/1.1"
    14. ["server_port"]=>
    15. int(4501)
    16. ["remote_port"]=>
    17. int(31205)
    18. ["remote_addr"]=>
    19. string(14) "**購買的高防IP**"
    20. ["master_time"]=>
    21. int(1613802357)
    22. }

    header中的 字段

    1. array(11) {
    2. ["host"]=>
    3. string(21) "添加的域名"
    4. ["x-real-ip"]=>
    5. string(13) "真實的訪客IP"
    6. ["x-forwarded-host"]=>
    7. string(15) "訪問域名"
    8. ["x-forwarded-scheme"]=>
    9. string(4) "http"
    10. ["x-forwarded-for"]=>
    11. string(13) "真實的訪客IP"
    12. ["user-agent"]=>
    13. string(115) "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"
    14. ["connection"]=>
    15. string(10) "keep-alive"
    16. ["accept"]=>
    17. string(50) "image/avif,image/webp,image/apng,image/*,*/*;q=0.8"
    18. ["referer"]=>
    19. string(29) "..."
    20. ["accept-encoding"]=>
    21. string(13) "gzip, deflate"
    22. ["accept-language"]=>
    23. string(14) "zh-CN,zh;q=0.9"
    24. }
  2. 源服務器使用代理服務轉發端口的請求(如使用nginx轉發)。
    nginx 配置參考

    1. server {
    2. listen 8481;#如源機接收請求的端口設置為8481端口,而8481端口又轉發請求
    3. server_name localhost;
    4. root /home/www/;
    5. index index.php;
    6. location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
    7. expires 100d;
    8. }
    9. location ~ .*\.(js|css)?$ {
    10. expires 30d;
    11. }
    12. location ~ \.php$ {
    13. fastcgi_pass 127.0.0.1:9000;
    14. fastcgi_index index.php;
    15. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    16. fastcgi_param PATH_INFO $fastcgi_path_info;
    17. fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
    18. include fastcgi_params;
    19. }
    20. }

    返回字段參考

    1. array
    2. {
    3. [USER] => www-data
    4. [HOME] => /home/www-data
    5. [HTTP_COOKIE] => yisu_sign_javascript=8bc2a608d434ebc5e6914faf090c4bda
    6. [HTTP_ACCEPT_LANGUAGE] => zh-CN,zh;q=0.9
    7. [HTTP_ACCEPT_ENCODING] => gzip, deflate
    8. [HTTP_REFERER] => ...
    9. [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
    10. [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
    11. [HTTP_CACHE_CONTROL] => max-age=0
    12. [HTTP_CONNECTION] => keep-alive
    13. [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
    14. [HTTP_X_FORWARDED_FOR] => 真實訪客的IP
    15. [HTTP_X_FORWARDED_SCHEME] => http
    16. [HTTP_X_FORWARDED_HOST] => 訪問的域名
    17. [HTTP_X_REAL_IP] => 真實訪客IP
    18. [HTTP_HOST] => 添加的域名
    19. [REDIRECT_STATUS] => 200
    20. [SERVER_NAME] => localhost
    21. [SERVER_PORT] => 8481
    22. [SERVER_ADDR] => 源服務器地址
    23. [REMOTE_PORT] => 34338
    24. [REMOTE_ADDR] => 購買的高防IP
    25. [SERVER_SOFTWARE] => nginx/1.19.2
    26. [GATEWAY_INTERFACE] => CGI/1.1
    27. [REQUEST_SCHEME] => http
    28. [SERVER_PROTOCOL] => HTTP/1.0
    29. [DOCUMENT_ROOT] => /home/www
    30. [DOCUMENT_URI] => /index.php
    31. [REQUEST_URI] => /
    32. [SCRIPT_NAME] => /index.php
    33. [CONTENT_LENGTH] =>
    34. [CONTENT_TYPE] =>
    35. [REQUEST_METHOD] => GET
    36. [QUERY_STRING] =>
    37. [QY_DEBUG] => 1
    38. [QY_CONF] => dev
    39. [PATH_TRANSLATED] => /home/www
    40. [PATH_INFO] =>
    41. [SCRIPT_FILENAME] => /home/www/index.php
    42. [FCGI_ROLE] => RESPONDER
    43. [PHP_SELF] => /index.php
    44. [REQUEST_TIME_FLOAT] => 1613802985.2393
    45. [REQUEST_TIME] => 1613802985
    46. }

回源服務器地址為域名格式

配置

  • 源服務器使用代理服務轉發端口的請求(如使用nginx 轉發)
    返回字段參考
    1. Array
    2. {
    3. [USER] => www-data
    4. [HOME] => /home/www-data
    5. [HTTP_COOKIE] => yisu_sign_javascript=8bc2a608d434ebc5e6914faf090c4bda
    6. [HTTP_ACCEPT_LANGUAGE] => zh-CN,zh;q=0.9
    7. [HTTP_ACCEPT_ENCODING] => gzip, deflate
    8. [HTTP_REFERER] => ...
    9. [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
    10. [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
    11. [HTTP_CACHE_CONTROL] => max-age=0
    12. [HTTP_CONNECTION] => keep-alive
    13. [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
    14. [HTTP_X_FORWARDED_FOR] => 真實訪客的IP
    15. [HTTP_X_FORWARDED_SCHEME] => http
    16. [HTTP_X_FORWARDED_HOST] => 訪問的域名
    17. [HTTP_X_REAL_IP] => 真實訪客IP
    18. [HTTP_HOST] => 是添加的域名,不是回源填寫的域名
    19. [REDIRECT_STATUS] => 200
    20. [SERVER_NAME] => localhost
    21. [SERVER_PORT] => 8481
    22. [SERVER_ADDR] => 源服務器地址
    23. [REMOTE_PORT] => 34338
    24. [REMOTE_ADDR] => 購買的高防IP
    25. [SERVER_SOFTWARE] => nginx/1.19.2
    26. [GATEWAY_INTERFACE] => CGI/1.1
    27. [REQUEST_SCHEME] => http
    28. [SERVER_PROTOCOL] => HTTP/1.0
    29. [DOCUMENT_ROOT] => /home/www
    30. [DOCUMENT_URI] => /index.php
    31. [REQUEST_URI] => /
    32. [SCRIPT_NAME] => /index.php
    33. [CONTENT_LENGTH] =>
    34. [CONTENT_TYPE] =>
    35. [REQUEST_METHOD] => GET
    36. [QUERY_STRING] =>
    37. [QY_DEBUG] => 1
    38. [QY_CONF] => dev
    39. [PATH_TRANSLATED] => /home/www
    40. [PATH_INFO] =>
    41. [SCRIPT_FILENAME] => /home/www/index.php
    42. [FCGI_ROLE] => RESPONDER
    43. [PHP_SELF] => /index.php
    44. [REQUEST_TIME_FLOAT] => 1613802985.2393
    45. [REQUEST_TIME] => 1613802985
    46. }
澎湖县| 清新县| 凉山| 仙桃市| 叶城县| 永春县| 澄城县| 林芝县| 三台县| 庆安县| 惠东县| 南丰县| 都江堰市| 朔州市| 尤溪县| 维西| 诏安县| 曲阜市| 武清区| 山阴县| 汉沽区| 饶河县| 文安县| 新巴尔虎右旗| 清镇市| 拉萨市| 双柏县| 浠水县| 丰城市| 睢宁县| 永寿县| 澄迈县| 南昌市| 舒城县| 西贡区| 新津县| 丹东市| 东安县| 油尖旺区| 临澧县| 屏东市|