mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
In Angular and ReactRedux templates, the FetchData sample page fails if served over HTTPS with self-signed cert #608
Closed
opened 2025-08-09 17:16:57 +00:00 by fergalmoran
·
0 comments
No Branch/Tag Specified
master
rybrande/masterToSrc
pakrym/no-console-fb
release/2.2
pakrym/remove-obsole-api-usage
maestro/release/2.2
maestro/master
release/2.1
release/2.0
rybrande/MergeRelease21IntoDev
rel/2.0.0-extensions
angular-animations-example
fix-angular-material-publishing
rel/2.0.0-templates
httpwithstatetransfer-example
rel/2.0.0-preview2-templates
aspnet-webpack-react-2.x
angular4-prerender-data-example
version-1.x
angular2-lazy-loading-example
581-isomorphic-react-cookies-example
example-using-typescript-paths-for-494
v1.0.x
angular2-materialize-example
redux-typed-1-x
primeng-example
font-awesome-example
karma-testing-example
2.2.0
2.2.0-preview3
2.2.0-preview2
2.2.0-preview1
2.1.1
2.1.0
2.0.4
2.1.0-rc1-final
2.1.0-preview2-final
2.0.3
2.1.0-preview1-final
2.0.2
2.0.1
rel/2.0.0
rel/2.0.0-preview2
Labels
Clear labels
2 - Working
2 - Working
3 - Done
3 - Done
3 - Done
3 - Done
3 - Done
3 - Done
3 - Done
angular
angular
angular
angular
angular
bug
bug
bug
bug
bug
bug
bug
bug
bug
core
core
core
core
core
core
core
duplicate
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
external
external
P1
P1
P1
P1
P1
P1
P2
P2
P2
P2
P2
P2
P2
P2
P2
PRI: 1 - Required
react
react
task
task
up-for-grabs
up-for-grabs
up-for-grabs
waiting
waiting
waiting
waiting
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
fergalmoran
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github/JavaScriptServices#608
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SteveSandersonMS on 7/5/2017
The underlying issue is that Node.js doesn't respect the OS-configured trusted CAs (details - and note it's still the case in Node 8.x, even though this issue was marked closed). This means it doesn't recognise self-signed certs such as an IISExpress development cert, even if you agreed to register it as trusted in the OS. Instead, Node expects you to use a technique like this to manually load your trusted certs from files on disk.
The consequence is that, during server-side prerendering, API requests to
https://localhost...will fail if the cert isn't chained to one of Node's built-in CAs. Hence you will get an error if you try to do server-side prerendering on the "fetchdata" page in the Angular or ReactRedux templates.Possible workarounds
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";.agent: new (https.Agent)({ rejectUnauthorized: false })on the call to Node's nativehttpsAPI, if you can access that.trusted-ca(for Mac and some Linux distributions) plusnode-windows-certs.Workaround 3 would be best if it was robust, but it's hard to be sure of that, given that Linux distributions could put their CA cert store anywhere. It really feels like it should be a native feature in Node, not something hacked in at the application level.
Workaround 2 would be OK, since you'd only do it on requests that you know are going to your own backend server. However it's not really practical in the Angular case, because Angular apps are so deeply abstracted and there's no simple way of passing arbitrary options to Node's
httpsAPI (reported as bug to request workaround). It would be OK in the ReactRedux case, but we don't want a solution that only works in one place.Workaround 1 might be acceptable if we know your application was built in development mode. You wouldn't want this global flag set in production, hopefully.