Skip to content

ng serve behind HTTPS reverse proxy is failing to call https://localhost:4200 #2123

Closed
@jandsu

Description

@jandsu

Running ng serve behind an HTTPS reverse proxy is making requests on https://localhost:4200 when it should make them on http://localhost:4200

OS?

Ubuntu 16.04

Versions?

$ ng --version
angular-cli: 1.0.0-beta.11-webpack.9-4
node: 6.5.0
os: linux x64

Repro steps

  1. ng new foo
  2. cd foo
  3. ng serve
  4. Then I load the page on https://mywebserver.mydomain.org which is the page served by a reverse proxy
    ==> observe the network tab in Chrome developer tools, it keeps making requests on
https://localhost:4200/sockjs-node/info?t=1473926195156

which fail when the same URL starting with http:// works


I have an HTTPS reverse proxy in front (to be able to route API calls - it needs to be HTTPS because I use the geolocation API). Here is an excerpt of the NGINX configuration file.

$ cat /etc/nginx/sites-enabled/my-test
server {
    listen 443 ssl;
        location / {
        proxy_pass http://localhost:4200;
    }
    ssl_certificate /etc/nginx/ssl/myserver.crt;
    ssl_certificate_key /etc/nginx/ssl/myserver-private.key;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions