tencent cloud

Feedback

Directions

Last updated: 2022-06-20 10:43:56
    Note:

    If there are problems with backend adaptation you cannot fix, please submit a ticket for assistance.

    Step 1: Create an HTTP/HTTPS Listener

    Log in to the GAAP console. Select Access Management > HTTP/HTTPS Listener Management. Click Create to add an HTTP/HTTPS listener, and then complete configurations required to create the listener and connection.

    Step 2: Adapt the Backend Server

    The following sections describe the X-Forwarded-For configuration schemes for Nginx, IIS 7, and Apache servers.

    IIS 7 configuration scheme

    1. Download and install the F5XForwardedFor plugin module, copy F5XFFHttpModule.dll and F5XFFHttpModule.ini in the x86\Release or x64\Release directory based on your server operating system version to a certain directory (such as C:\F5XForwardedFor in this document), and make sure that the IIS process has read permission to this directory.
    2. Select IIS Server and double-click Modules.
    3. Click Configure Native Modules.
    4. In the pop-up window, click Register.
    5. Add the downloaded DLL files.
    6. After adding the files, check them and click OK.
    7. Add the above two DLL files in "ISAPI and CGI Restrictions" and set the restrictions to "Allow".
    8. Restart the IIS server for the configuration to take effect.

    Apache configuration scheme

    1. Install the Apache "mod_rpaf" module using the following commands:

      wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz
      tar zxvf mod_rpaf-0.6.tar.gz
      cd mod_rpaf-0.6
      /usr/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c
      
    2. Modify the Apache configuration file /etc/httpd/conf/httpd.conf by adding the following to the end of the file:

      LoadModule rpaf_module modules/mod_rpaf-2.0.so
      RPAFenable On
      RPAFsethostname On
      RPAFproxy_ips IP address   //The IP address is the forwarding IP of the connection
      RPAFheader X-Forwarded-For
      
    3. After adding the above content, restart Apache.

      /usr/sbin/apachectl restart
      

    Nginx configuration scheme

    1. You can use http_realip_module to get the real client IP when Nginx is used as the server. However, this module is not installed in Nginx by default, and you need to recompile Nginx to add --with-http_realip_module. The code is as follows:

      wget  http://nginx.org/download/nginx-1.14.0.tar.gz 
      tar  zxvf nginx-1.14.0.tar.gz 
      cd nginx-1.14.0
      ./configure --user=www --group=www --with-http_stub_status_module --without-http-cache --with-http_ssl_module --with-http_realip_module
      make
      make install
      
    2. Modify the nginx.conf file.


      vi /etc/nginx/nginx.conf
      Modify the configuration fields in red as follows:
      fastcgi connect_timeout 300; fastcgi send_timeout 300; fastcgi read_timeout 300; fastcgi buffer_size 64k; fastcgi buffers 4 64k; fastcgi busy_buffers_size 128k; fastcgi temp_file_write_size 128k;
      set_real_ip_from IP address; //The IP address is the forwarding IP of the connection real_ip_header X-Forwarded-For;
    3. Restart Nginx.

      service nginx restart
      
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support