Configure Artifactory for PTC
Configure JFrog Artifactory remote repositories and register package types for Package Traffic Controller (PTC).
JFrog Artifactory Configuration
This section covers the JFrog Artifactory side of PTC setup: create remote repositories, ensure Curation is enabled, register each package type with Package Reroute through the REST API (which auto-enrolls the repository in Curation by default), and verify the redirect endpoint. Complete this before security edge redirect rules are activated; see Deployment Sequence.
Important — PTC
repo_keymust be a remote repository: The Package Rerouterepo_keymust point to a remote repository. Virtual repositories are not supported as the PTCrepo_key.
Complete the following procedures in order (after Prerequisites):
- Step 1: Create a Remote Repository
- Step 2: Ensure JFrog Curation Is Enabled
- Step 3: Register Repositories with Package Reroute (Mandatory)
- Step 4: Verify the Redirect Endpoint
Repository Architecture
PTC requires the following repository structure:
- Remote Repository: Proxies and caches packages from the upstream public registry, and is the only supported
repo_keytarget for Package Reroute. JFrog Curation policies apply at this layer when Curation is enabled for that remote.
The Package Reroute repo_key must point to a remote repository. Virtual repositories are not supported as the repo_key target—they prevent JFrog from tracking consumption accurately and from configuring Curation automatically on the upstream-facing repository.
Step 1: Create a Remote Repository
The steps below use npm and registry.npmjs.org as a worked example. For each other package type you support, create a remote repository of the matching package type with that ecosystem's public registry URL, then map each type in the Package Reroute Config API the same way.
To create a remote repository for PTC:
- Navigate to Administration > Repositories > Remote.
- Click New Remote Repository.
- Package Type: Select
npm. - Repository Key: Enter a descriptive name, for example
npm-remote-registry. - URL:
https://registry.npmjs.org - Click Create.
The remote repository is created and ready to map in the Package Reroute Config API.
Step 2: Ensure JFrog Curation Is Enabled
Make sure JFrog Curation is enabled in your Artifactory instance before calling the Package Reroute API in Step 3. The API auto-enrolls the target remote repository in Curation when linked_curation is true (the default), so you do not need to connect individual repositories to Curation manually.
To skip Curation enrollment for a specific repository, send linked_curation: false in the Step 3 request body.
For how to enable and configure Curation, see Configure JFrog Curation.
Step 3: Register Repositories with Package Reroute (Mandatory)
This step is mandatory. After the remote repository exists and Curation is enabled (see Step 2), map each package type you enable to that remote repository's repo_key using the Update Registry Configuration API (PUT /artifactory/api/package-reroute/config/{type}). See Package Reroute Config API.
This API call does three things: it tells PTC which Artifactory remote repository to use for each package type, creates the _package-reroute system user that handles redirected traffic, and (by default) auto-enrolls the repository in Curation. PTC does not work until this step completes.
The repo_key must reference a remote repository. Virtual repositories are not supported.
Supported type values are npm, pypi, docker, huggingfaceml, gems (RubyGems), and cargo (Rust). Repeat the call for every ecosystem you roll out.
To register npm with Package Reroute:
- Use the remote repository key from Step 1 (for example
npm-remote-registry) as therepo_key. - Call
PUT /artifactory/api/package-reroute/config/npmwith that key in the request body. - Confirm the response returns HTTP 200 and the same
repo_key. - Optionally call Get Registry Configuration (
GET /artifactory/api/package-reroute/config/{type}) or Get Full Configuration (GET /artifactory/api/package-reroute/config) to verify the mapping. See Package Reroute Config API.
curl -X PUT "https://<YOUR_ARTIFACTORY_URL>/artifactory/api/package-reroute/config/npm" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"repo_key": "npm-remote-registry"}'Where:
<YOUR_ARTIFACTORY_URL>: Your JFrog Platform hostname (for exampleacme.jfrog.io)<token>: Admin JWT or use Basic authentication per Package Reroute Config APIrepo_key: The remote repository key from Step 1
Package Reroute is configured for npm. Repeat PUT /artifactory/api/package-reroute/config/{type} for each additional package type (for example pypi, docker, huggingfaceml, gems, cargo) before you enable security edge redirect rules for those ecosystems.
Note
After calling this endpoint, a system user (
_package-reroute) is created in Artifactory and handles all redirected PTC traffic. This user appears in your logs and audit entries for PTC-redirected requests — this is expected. PTC repositories are accessible without end-user credentials by design — the_package-reroutesystem user holds the necessary permissions on your behalf. You do not need to configure anonymous access on the Artifactory instance. The PTC remote repositories themselves allow unauthenticated access; this is expected and required for the redirect flow to work.If the
_package-rerouteuser is deleted, or if a PTC repository is deleted, call this endpoint again (with any package type). The endpoint recreates the user and restores the repository mapping.
Upgrading from Artifactory earlier than 7.161?
Run this endpoint once for any package type you have already configured. You do not need to run it for every package type — a single call creates the
_package-rerouteuser and removes the need for the anonymous access configuration required in earlier versions.
By default (linked_curation: true), a successful call also auto-enrolls the target remote repository in Curation. Send linked_curation: false in the request body to register the repository for reroute without enrolling it in Curation.
Error responses
The Update Registry Configuration API (PUT /artifactory/api/package-reroute/config/{type}) returns the following errors when the request cannot be applied:
| Status | Meaning | What to do |
|---|---|---|
400 | Unsupported package type, missing/invalid repo_key, or the referenced remote repository does not exist. | Confirm the package type is supported and that repo_key points to an existing remote repository (not a virtual repository). |
407 | Proxy Authentication Required before the package-reroute flow can proceed. | Ensure the request is authenticated with the proxy. Also see Step 4: Verify the Redirect Endpoint. |
422 | Curation cannot be enabled for the target repository: either Curation is not enabled in Artifactory, or the package type is not supported by Curation. Only returned when linked_curation is true (the default). | Enable Curation in Artifactory (see Step 2) or send linked_curation: false to skip Curation enrollment. |
503 | Failed to enable Curation for the repo_key. Only returned when linked_curation is true (the default). | Retry, or send linked_curation: false to skip Curation enrollment, then enable Curation in Artifactory (see Step 2). |
Step 4: Verify the Redirect Endpoint
The /artifactory/api/package-reroute entry point on the JFrog Router is where security edge-redirected client traffic lands. It is product-defined and not customer-configurable. You can validate it before redirect rules are enabled by calling Artifactory directly with the same query shape your security edge will append (url= original registry URL, percent-encoded).
To verify the package-reroute redirect endpoint:
Build https://<hostname>/artifactory/api/package-reroute?url=<percent-encoded-upstream-url> using your Artifactory hostname. Percent-encode the value of url (for https://registry.npmjs.org/express use https%3A%2F%2Fregistry.npmjs.org%2Fexpress). Example (fictional tenant acme.jfrog.io):
curl -v "https://<YOUR_ARTIFACTORY_URL>/artifactory/api/package-reroute?url=https%3A%2F%2Fregistry.npmjs.org%2Fexpress"Where:
<YOUR_ARTIFACTORY_URL>: Your JFrog Platform hostname (for exampleacme.jfrog.io)
Use your own hostname. The Router path is /artifactory/api/package-reroute. If an encoded url fails in your shell, try single-quoting the full URL or passing --data-urlencode via curl -G.
Expected: HTTP 302 or 307 with a Location header pointing to an Artifactory URL (typically under /artifactory/api/npm/<your-remote>/... for the express package, not still on registry.npmjs.org). Do not use curl -L if you only want to inspect the first hop.
If the response is not 302/307, see Verify the Redirect Endpoint troubleshooting for the common causes (401/403, 407, 404, very long url= values).
For details on how to find and interpret PTC reroute lines in Artifactory's system logs, see Package Reroute Logs for PTC.
Frequently Asked Questions
This section provides answers to frequently asked questions about configuring JFrog Artifactory for Package Traffic Controller (PTC).
FAQs
Q: Is the Package Reroute API call mandatory for PTC?
A: Yes. You must call PUT /artifactory/api/package-reroute/config/{type} for each package type you enable before redirect rules intercept traffic. See Step 3: Register repositories with Package Reroute (mandatory).
Q: Can the Package Reroute repo_key point to a virtual repository?
repo_key point to a virtual repository?A: No. The repo_key must reference a remote repository. Virtual repositories are not supported. See Repository Architecture.
Q: Does PTC still require anonymous access on Artifactory?
A: No. From Artifactory 7.161, calling the Package Reroute config endpoint creates the _package-reroute system user that handles all redirected traffic. No anonymous access configuration is required. If you set up PTC before 7.161, run the config endpoint once to create the user and remove the anonymous access requirement.
Q: What HTTP response should I expect from /artifactory/api/package-reroute?
/artifactory/api/package-reroute?A: A successful test returns HTTP 302 or 307 with a Location header pointing at your Artifactory remote repository path—not the public registry hostname. See Step 4: Verify the Redirect Endpoint.
Related Topics
Updated 15 days ago
