-
Notifications
You must be signed in to change notification settings - Fork 486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Nu1302 documentation with more information #3363
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,14 +8,38 @@ f1_keywords: | |
- "NU1302" | ||
--- | ||
|
||
# NuGet Warning NU1302 | ||
# NuGet Error NU1302 | ||
|
||
> 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. | ||
|
||
### Issue | ||
|
||
`myHttpSource` is an insecure HTTP source. We recommend using HTTPS sources instead. | ||
`myHttpSource` is an insecure HTTP source. We recommend using an HTTPS sources instead. | ||
|
||
### Solution | ||
|
||
This can be fixed either by removing the HTTP source or disabling HTTP Errors for the specific source by using `allowInsecureConnections` option in your [NuGet config file](../../reference/nuget-config-file.md). | ||
#### Option 1: Update the Source to Use HTTPS | ||
If possible, update the package source to use `https://` instead of `http://`: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add space after each heading. |
||
```xml | ||
<configuration> | ||
<packageSources> | ||
<add key="SecureSource" value="https://example.com/nuget/" /> | ||
</packageSources> | ||
</configuration> | ||
``` | ||
#### Option 2: Allow Insecure Connections (If Necessary) | ||
If the source must remain HTTP, explicitly allow insecure connections by adding the `AllowInsecureConnections` flag in the `NuGet.Config`: | ||
```xml | ||
<configuration> | ||
<packageSources> | ||
<add key="InsecureSource" value="http://example.com/nuget/" allowInsecureConnections="true" /> | ||
</packageSources> | ||
</configuration> | ||
``` | ||
|
||
#### Option 3: Consult SDK Analysis Level | ||
Ensure that the project’s `SdkAnalysisLevel` allows HTTP sources: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably link to the actual SdkAnalysisLevel docs. Similar to how this is done in the NU19* codes.
The following |
||
- SDK versions **below 9.0.100** generate a warning (NU1803). | ||
- SDK versions **9.0.100 or higher** enforce the error (NU1302) unless `AllowInsecureConnections` is explicitly enabled. | ||
|
||
Check the `SdkAnalysisLevel` of your project and upgrade or adjust settings as necessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.