-
Notifications
You must be signed in to change notification settings - Fork 12k
ng serve behind HTTPS reverse proxy is failing to call https://localhost:4200 #2123
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
Comments
FWIW, same issue with beta 14
|
Calls like Not sure what I can do to help in your case, it's not really a problem with the CLI I believe. I'll flag it for community help. Maybe documentation for the proxy feature helps? #1896 |
Please let me respectfully disagree. To me, this is a bug, not a question for support.
In other words, if the CLI is smart enough to replace the hostname with localhost and port with 4200, it should be smart enough to alter the scheme as well and systematically use http which the live-reload is serving... If it does not want to be that smart then it should let the window.location untouched. |
I'll second @jandsu with another use case. We utilize vagrant for our development environment and typically use a local We use vagrant so that developers who are working on multiple projects do not have to manage a projects dependancies on their machines. So that means we run things like What this results in is the app using It does appear that supporting a custom host for reload was intended in serve based on what's showing here:
I did try putting this to use, but it does not appear to have any impact on the host used in the reload script. |
via issue #1753 i found that by setting the host to 0.0.0.0 via @jandsu I'm not sure if this will also resolve your issue since yours appears to be protocol vs host, but it's probably worth a shot. Assuming my assumptions here are correct, it appears that the readme could use a little updating and / or the Hope this helps someone else! |
I tried changing liveReloadPort to 443 with no apparent change on the client. I am reverse proxying https:// to 4200, so the desired behavior would be for the client to request a different port to what the server is hosting. |
This is a Webpack issue, reproducible without Angular CLI. I created an issue, please vote for it (and add more info if you have some): webpack/webpack-dev-server#763. EDIT: It turns out it's not fixable inside Webpack. On the other hand, PR #3952 does fix it for me so vote for it if you need this feature. |
+1 |
Fixed by #3952. |
For anyone stumbling on this issue, there is indeed a For now, I found this very dirty hack:
It works fine with Angular CLI 1.4.1. It only works because some code in webpack checks if the protocol contains 'http'... (and not is http[s]). The zero-port is required if you serve SSL on a non-standard port (which is my case, the 443 is used for the built version rather than ng serve). The NGINX config that works for me is:
|
^ The above worked for me. I also had to set |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Running
ng serve
behind an HTTPS reverse proxy is making requests on https://localhost:4200 when it should make them on http://localhost:4200OS?
Ubuntu 16.04
Versions?
Repro steps
ng new foo
cd foo
ng serve
==> observe the network tab in Chrome developer tools, it keeps making requests on
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.
The text was updated successfully, but these errors were encountered: