Description
We have integrated our shop application with Angular SSR (Server-Side Rendering). In this setup, certain API requests are executed on the server (Node.js) during the rendering phase, and the data is transferred to the client.
If a server-side request fails, the application falls back to client-side execution, and the data (e.g., categories) loads successfully in the browser.
Backend Configuration
The backend gateway is implemented using the ABP Framework with OpenIddict but end point is opened.
Observations SSR runs in a Node.js environment, not in the browser Browser requests automatically include authentication (cookies or tokens) SSR requests may not include the same authentication context If SSR fails, the client-side fallback works correctly and loads the data
Suspected Causes
We are not certain about the exact root cause, but possible reasons include:
Authentication not being forwarded during SSR Missing cookies or access tokens in server-side requests Differences in request context SSR requests may not include required headers (Authorization / cookies) CORS or origin-related differences Requests originating from Node.js instead of browser (Possibly) SSL / certificate-related configuration Only if backend enforces stricter validation for non-browser clients
Steps to Reproduce Configure Angular application with SSR Connect it to an ABP backend secured with OpenIddict Call a API during SSR rendering Observe failure in SSR Access the same API via browser/Postman → works successfully
Expected Behavior
SSR should be able to call secured APIs when properly authenticated or should have a recommended pattern for handling such scenarios.
Actual Behavior SSR API call fails with an exception Client-side fallback successfully retrieves and displays data
Error in node.js
UNABLE_TO_VERIFY_LEAF_SIGNATURE
2 Answer(s)
-
0
UNABLE_TO_VERIFY_LEAF_SIGNATUREis not an ABP/OpenIddict authentication failure. It’s a Node.js TLS trust-chain validation error during SSR when Node calls your ABP backend over HTTPS and cannot validate the server certificate chain (very common with missing intermediate certs, corporate TLS interception, or self-signed/internal CA certs).
That’s why it can “work in browser/Postman” (they often use OS trust store / may have different trust behavior) but fail in SSR (Node uses its own CA bundle).Fix it on the certificate / chain side (recommended):
- Ensure your API/AuthServer HTTPS endpoint presents the full certificate chain (server cert + intermediates).
- If you’re using Nginx/Apache/IIS/reverse-proxy, configure it to serve the full chain (often called
fullchain.pemon Let’s Encrypt setups).
- If you’re using Nginx/Apache/IIS/reverse-proxy, configure it to serve the full chain (often called
- If you have an internal CA, add that CA to the machine trust and/or supply it to Node (next bullet).
- Ensure your API/AuthServer HTTPS endpoint presents the full certificate chain (server cert + intermediates).
Fix it on the SSR Node runtime side (when you must trust a private CA):
- Export the issuing CA (or corporate proxy CA) as a PEM file, e.g.
corp-root-ca.pem. - Start SSR with:
NODE_EXTRA_CA_CERTS=/path/to/corp-root-ca.pem- (Optional for debugging only)
NODE_DEBUG=tlsThis makes Node trust that CA and resolvesUNABLE_TO_VERIFY_LEAF_SIGNATUREwithout disabling TLS checks.
- Export the issuing CA (or corporate proxy CA) as a PEM file, e.g.
Avoid this “quick fix” in production (insecure):
- Setting
NODE_TLS_REJECT_UNAUTHORIZED=0or using an HTTPS agent withrejectUnauthorized: falsewill bypass TLS verification entirely. It may “make it work”, but it weakens security and should not be used beyond local debugging.
- Setting
After TLS is fixed, if the API is actually secured and SSR must call it authenticated:
- SSR must forward the same auth context (cookies / bearer token) from the incoming browser request to your ABP backend when rendering. This is an Angular SSR integration concern; ABP will only accept what the request contains.
Links (verified):
- https://abp.io/docs/latest/modules/openiddict
- https://abp.io/docs/latest/solution-templates/layered-web-application/deployment/openiddict-deployment
- https://abp.io/community/articles/0znavo8r
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
The error
UNABLE_TO_VERIFY_LEAF_SIGNATUREis a Node.js SSL/TLS certificate chain verification error. This is not related to ABP or OpenIddict authentication — it means Node.js cannot verify the SSL certificate of your backend server during SSR requests.To help confirm the root cause, could you provide some details:
- Is your ABP backend running on HTTPS? If so, are you using a self-signed certificate or a certificate from a trusted CA?
- Are you running this in a development environment or production?
- Could you share the backend URL (or just the domain/host) so we can check the certificate chain?
- Does setting the environment variable
NODE_TLS_REJECT_UNAUTHORIZED=0before starting your SSR server make the error go away? (This is only for testing, not a production solution.)
Thanks
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)