Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-28446

Maven proxy repository will return 502 response instead of 404 when manually blocked for content not yet cached

    XMLWordPrintable

    Details

      Description

      In NXRM 3 add a Maven proxy repository and select the option to manually block outbound connections for it.

      Configure a Maven build to use the proxy repository URL as one of its remote repositories.

      Perform a Maven build. When Maven requests content from the repository the status code will be 502 for content not yet cached.

      Compare this to NXRM version 2, where instead a 404 response will be returned, with an HTML page containing the reason why 404 was returned is provided to the end user:

      <html>
        <head>
          <title>404 - Repository proxy-mode is BLOCKED_MANUAL, remote access not allowed from M2Repository(id=central)</title>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      
          <link rel="icon" type="image/png" href="http://localhost:8081/favicon.png">
          <!--[if IE]>
          <link rel="SHORTCUT ICON" href="http://localhost:8081/favicon.ico"/>
          <![endif]-->
      
          <link rel="stylesheet" href="http://localhost:8081/static/css/Sonatype-content.css?2.14.20-02" type="text/css" media="screen" title="no title" charset="utf-8">
        </head>
        <body>
          <h1>404 - Repository proxy-mode is BLOCKED_MANUAL, remote access not allowed from M2Repository(id=central)</h1>
          <p>Repository proxy-mode is BLOCKED_MANUAL, remote access not allowed from M2Repository(id=central)</p>
        </body>
      </html>
      

      Workaround

      In general configuring a Maven build to point at a proxy repository is not recommended. Instead a maven build should refer to a group repository, containing the proxy repository as a member repo. A group repository will return 404 in this case, if no content found in any member, even if one or more member repos is blocked state.

      Expected

      Return 404 and a suitable message in the payload indicating why, if the repository does not have the content requested and the repository has been intentionally manually blocked or automatically blocked.

      Maintain the condition that If the content is present and the remote cannot be reached, serve the cached content.

      Make sure the group repository handling of any group repo containing this proxy repository treats the proxy member as returning no content ( not found ).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              plynch Peter Lynch
              Last Updated By:
              Maksym Kalachov Maksym Kalachov
              Team:
              NXRM - Mad Max
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Date of First Response:

                  tigCommentSecurity.panel-title