Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-17710

Cannot work with Xray when it has a context path in the URL

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 6.5.0
    • Fix Version/s: 6.12.0
    • Component/s: None
    • Labels:
    • Sprint:
      Pam - Quality 2, Pam - Quality 3, Pam - Quality 4

      Description

      When Xray is configured with a context path in the URL, the integration with Artifactory doesn't work.

      The test connection in Xray works well, but that is. Artifactory heartbeat doesn't work and Artifactory is not sending indexing requests to the correct endpoint.

      Base URL is configured as follows:

      <baseUrl>http://10.132.0.51/xray</baseUrl>
      

      But, Artifactory sends requests as follows (seen by adding HTTP logger):

      2018-10-25 10:57:15,375 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 >> "GET /api/v1/system/version HTTP/1.1[\r][\n]"
      2018-10-25 10:57:15,375 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 >> "Host: 10.132.0.51:80[\r][\n]"
      2018-10-25 10:57:15,375 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 >> "Connection: Keep-Alive[\r][\n]"
      2018-10-25 10:57:15,375 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 >> "User-Agent: XrayJavaClient/1.0.8[\r][\n]"
      2018-10-25 10:57:15,376 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 >> "[\r][\n]"
      2018-10-25 10:57:15,383 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "HTTP/1.1 404 Not Found[\r][\n]"
      2018-10-25 10:57:15,383 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "Server: nginx/1.10.3[\r][\n]"
      2018-10-25 10:57:15,384 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "Date: Thu, 25 Oct 2018 10:57:15 GMT[\r][\n]"
      2018-10-25 10:57:15,384 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "Content-Type: text/html[\r][\n]"
      2018-10-25 10:57:15,384 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "Content-Length: 169[\r][\n]"
      2018-10-25 10:57:15,384 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "Connection: keep-alive[\r][\n]"
      2018-10-25 10:57:15,384 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "[\r][\n]"
      2018-10-25 10:57:15,384 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "<html>[\r][\n]"
      2018-10-25 10:57:15,384 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "<head><title>404 Not Found</title></head>[\r][\n]"
      2018-10-25 10:57:15,384 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "<body bgcolor="white">[\r][\n]"
      2018-10-25 10:57:15,384 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "<center><h1>404 Not Found</h1></center>[\r][\n]"
      2018-10-25 10:57:15,384 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "<hr><center>nginx/1.10.3</center>[\r][\n]"
      2018-10-25 10:57:15,384 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "</body>[\r][\n]"
      2018-10-25 10:57:15,384 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :72) - http-outgoing-767 << "</html>[\r][\n]"
      2018-10-25 10:57:20,368 [pool-14-thread-1] [DEBUG] (o.a.h.wire          :86) - http-outgoing-767 << "[read] I/O error: Read timed out"
      

      As you can see from the above, the "Xray" context is missing.

      Steps to reproduce:
      1. Setup Xray with an NGINX it is accessible via a context path, here is the configuration I used:

      upstream xray_app {
          server 10.156.0.4:8000;
      }
      
      server {
      
          listen 80;
          server_name 35.233.0.152 10.132.0.51;
      
          access_log /var/log/nginx/app.log;
          error_log /var/log/nginx/app.error.log;
      
      #    gzip on; - enables gzip compression
      #    gzip_vary on: - tells proxies to cache both gzipped and regular versions of a resource
      #    gzip_min_length 10240; - informs NGINX to not compress anything smaller than the defined size
      #    gzip_proxied - compress data even for clients that are connecting via proxies (here we're enabling compression if: a response header includes the "expired", "no-cache", "no-store", "private", and "Authorization" parameters)
      #    gzip_types - enables the types of files that can be compressed
      #    gzip_disable "MSIE [1-6]\."; - disable compression for Internet Explorer versions 1-6
      
          gzip on;
          gzip_vary on;
          gzip_min_length 10240;
          gzip_proxied expired no-cache no-store private auth;
          gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
          gzip_disable "MSIE [1-6]\.";
      
          location /xray/ {
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header Host $http_host;
      
              #sub_filter disabled for gzip by default
              proxy_set_header Accept-Encoding "";
      
              proxy_pass http://xray_app/;
              #rewrite default redirect "location" header http://<host>/web from xray
              proxy_redirect  /web http://$host/xray/web;
      
              # rewrite all suffix-like parts in HTML output
              sub_filter '/web/' '/xray/web/';
              sub_filter '/ui/' '/xray/ui/';
              sub_filter '/api/' '/xray/api/';
      
              sub_filter '/web' '/xray/web';
              sub_filter '/ui' '/xray/ui';
              sub_filter '/api' '/xray/api';
      
              # change every occurence for filter
              sub_filter_once off;
          }
          # process special AppGW front-end service endpoint /ui
          location /ui {
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header Host $http_host;
      
              #sub_filter disabled for gzip by default
              proxy_set_header Accept-Encoding "";
      
              proxy_redirect off;
              proxy_pass http://xray_app;
          }
          location /xray {
              #the last by order, special processing w/o trailing "/"
              return 301 http://$host/xray/;
          }
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection upgrade;
      }
      

      2. Access it via the NGINX using the context path, and configure with the Base URL with the context path.
      3. Configure Artifactory, see you are able to connect is succesfully.
      4. After configured, go to Artifactory and see the message that "JFrog Xray is unavailable. For details, please check Artifactory's log files".
      You can add an HTTP logger and see it is sending the request without the "xray" context path.

      INDEXING DOES NOT WORK AS WELL, Xray is not useable.

        Attachments

          Activity

            People

            • Assignee:
              tamirh Tamir Hadad
              Reporter:
              arielk Ariel Kabov
              Assigned QA:
              Nadav Yogev
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: