You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which I am trying to rewrite into http://host2/artifactory/api/nuget/onpremise-virtual-nuget-library/Packages(Id='F31.Ytos.Plugin.Account',Version='67.3.0')"
When using curl to test the uri gets encoded to: "uri": "/artifactory/api/nuget/v3/onpremise-virtual-nuget-library/Packages%28Id=%27F31.Ytos.Plugin.Account%27,Version=%2767.3.0%27%29"
I am attempting to strip out the encoded characters however this is failing when i get to %29.
the following works:
uri replace %28 "("
uri replace %27 "'"
result : "uri": "/artifactory/api/nuget/v3/onpremise-virtual-nuget-library/Packages(Id='F31.Ytos.Plugin.Account',Version='67.3.0'%29"
but when I add
uri replace %28 "("
uri replace %27 "'" uri replace %29 ")"
It ends up back like: uri": "/artifactory/api/nuget/v3/onpremise-virtual-nuget-library/Packages%28Id=%27F31.Ytos.Plugin.Account%27,Version=%2767.3.0%27%29
Caddy --version
v2.8.4
caddy run --watch Caddyfile
handle_path /artifactory/api/nuget/* {
rewrite * /artifactory/api/nuget/v3/onpremise-{uri}
uri replace onpremise-/ onpremise-
uri replace %28 "("
uri replace %27 "'"
uri replace %29 ")"
reverse_proxy https://host2 {
header_up Host {upstream_hostport}
}
}
We are using Caddy to rewrite URLs to Artifactory Cloud which does not understand encoded URLs. We have nuget queries that contain reserved characters like brackets eg.
http://host/artifactory/api/nuget/virtual-nuget-library/Packages(Id='F31.Ytos.Plugin.Account',Version='67.3.0')"
which I am trying to rewrite into http://host2/artifactory/api/nuget/onpremise-virtual-nuget-library/Packages(Id='F31.Ytos.Plugin.Account',Version='67.3.0')"
When using curl to test the uri gets encoded to: "uri": "/artifactory/api/nuget/v3/onpremise-virtual-nuget-library/Packages%28Id=%27F31.Ytos.Plugin.Account%27,Version=%2767.3.0%27%29"
I am attempting to strip out the encoded characters however this is failing when i get to %29.
the following works:
uri replace %28 "("
uri replace %27 "'"
result : "uri": "/artifactory/api/nuget/v3/onpremise-virtual-nuget-library/Packages(Id='F31.Ytos.Plugin.Account',Version='67.3.0'%29"
but when I add
uri replace %28 "("
uri replace %27 "'"
uri replace %29 ")"
It ends up back like: uri": "/artifactory/api/nuget/v3/onpremise-virtual-nuget-library/Packages%28Id=%27F31.Ytos.Plugin.Account%27,Version=%2767.3.0%27%29
Caddy --version
v2.8.4
caddy run --watch Caddyfile
curl -v "http://host/artifactory/api/nuget/virtual-nuget-library/Packages(Id='F31.Ytos.Plugin.Account',Version='67.3.0')"
result:
2024/09/18 11:27:42.421 DEBUG http.handlers.reverse_proxy upstream roundtrip {"upstream": "host2:443", "duration": 0.155411915, "request": {"remote_ip": "::1", "remote_port": "50987", "client_ip": "::1", "proto": "HTTP/1.1", "method": "GET", "host": "host2:443", "uri": "/artifactory/api/nuget/v3/onpremise-virtual-nuget-library/Packages%28Id=%27F31.Ytos.Plugin.Account%27,Version=%2767.3.0%27%29", "headers": {"X-Forwarded-For": ["::1"], "X-Forwarded-Proto": ["http"], "X-Forwarded-Host": ["host"], "User-Agent": ["curl/8.7.1"], "Accept": ["/"], "Authorization": ["REDACTED"]}}, "headers": {"Content-Type": ["application/json"], "Allow": ["DELETE,OPTIONS,PUT"], "Date": ["Wed, 18 Sep 2024 11:27:43 GMT"], "Connection": ["keep-alive"], "X-Jfrog-Version": ["Artifactory/7.94.1 79401900"], "X-Artifactory-Id": ["41ce1f82efe45c73c1e83adc3cc9be4d308371be"], "X-Artifactory-Node-Id": ["artifactory-primary-2"], "Strict-Transport-Security": ["max-age=31536000; preload"]}, "status": 405}
The text was updated successfully, but these errors were encountered: