Skip to content
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

SSL issues when using httpOptions as stated in the documentation #651

Open
yackinn opened this issue Aug 26, 2021 · 0 comments
Open

SSL issues when using httpOptions as stated in the documentation #651

yackinn opened this issue Aug 26, 2021 · 0 comments

Comments

@yackinn
Copy link

yackinn commented Aug 26, 2021


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

When using ssl on the dev server configuration and the Nestjs instance the request won't reach the server.

// main.ts
const httpsOptions = {
  key: fs.readFileSync(process.cwd() + '/storefront_app/config/server.key'),
  cert: fs.readFileSync(process.cwd() + '/storefront_app/config/server.crt')
};

async function bootstrap() {
  console.log(process.cwd() + '/storefront_app/config/server.crt');
  const app = await NestFactory.create(AppServerModule, {
    httpsOptions
  });
await app.listen(process.env.PORT || 4000);
...
}

// angular.json
...
"serve-ssr": {
          "builder": "@nguniversal/builders:ssr-dev-server",
          "options": {
            "ssl": true,
            "sslCert": "storefront_app/config/server.crt",
            "sslKey": "storefront_app/config/server.key",
            "browserTarget": "ui:build",
            "serverTarget": "server:build",
            "port": 4200,
            "host": "0.0.0.0"
          },

Expected behavior

The request should reach the server as it does wihtput using the httpOptions in the NestFactory.
When requesting a page using https and bootstrapping the Nest app instance without the httpOptions the request will reach the server as expected.

Minimal reproduction of the problem with instructions

We're following the instructions provided in this sample repository.
https://github.com/TrilonIO/universal-nest
When the app is configured as stated above the issue will occur.

What is the motivation / use case for changing the behavior?

We need the httpOptions to be able to use the push method on the response object.

Environment

Macos Big Sur 11.2.3 (20D91)


Nest version: 7.5.5

 
For Tooling issues:
- Node version: v14.17.1
- Platform:  Mac

Others:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant