Skip to content

Commit a85345c

Browse files
Revise NU1302 documentation with new scenarios (#3471)
1 parent 5525101 commit a85345c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

docs/reference/errors-and-warnings/NU1302.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ f1_keywords:
1010

1111
# NuGet Error NU1302
1212

13+
## Scenario 1
14+
1315
> You are running the 'restore' operation with an 'HTTP' source: myHttpSource. NuGet requires HTTPS sources. To use an HTTP source, you must explicitly set 'allowInsecureConnections' to true in your NuGet.Config file. Please refer to https://aka.ms/nuget-https-everywhere for more information.
1416
1517
### Issue
@@ -53,3 +55,34 @@ Here's how it functions:
5355

5456
> [!WARNING]
5557
> Changing SdkAnalysisLevel has other side-effects. Refer to the [`SdkAnalysisLevel`](/dotnet/core/project-sdk/msbuild-props#sdkanalysislevel) for a summary of the full scope of .NET SDK features affected.
58+
59+
## Scenario 2
60+
61+
> You are using a NuGet source 'https://contoso/v3/index.json' that contains an 'HTTP' service index resource endpoint: 'http://contoso/v3-flatcontainer/contoso/index.json'. This is insecure and not recommended. To allow HTTP resources, you must explicitly set 'allowInsecureConnections' to true in your NuGet.Config file. For more information, visit https://aka.ms/nuget-https-everywhere.
62+
63+
### Issue
64+
65+
A configured package source uses **HTTPS**, but one of its resources (indicated in the error message) uses **HTTP**.
66+
67+
NuGet requires that all sources and their resources use HTTPS.
68+
If you want to continue using this source despite its HTTP resource, you must set the `allowInsecureConnections` flag to true in your NuGet.config file.
69+
70+
To learn more about package sources and resource endpoints, take a look at the [NuGet Server API](../../api/overview).
71+
72+
#### Option 1: Update the Source to Use HTTPS
73+
74+
Whenever possible, switch to a package source that provides only HTTPS resources. This is the recommended and most secure option.
75+
76+
#### Option 2: Allow Insecure Connections (If Necessary)
77+
78+
If you must use the source, explicitly allow insecure connections by adding the `allowInsecureConnections` flag in the `NuGet.Config`:
79+
80+
For information about managing the setting in Visual Studio, see [NuGet Options in Visual Studio](../../consume-packages/nuget-visual-studio-options.md#allow-insecure-connections)
81+
82+
```xml
83+
<configuration>
84+
<packageSources>
85+
<add key="InsecureSource" value="https://contoso/v3/index.json" allowInsecureConnections="true" />
86+
</packageSources>
87+
</configuration>
88+
```

0 commit comments

Comments
 (0)