angular-http-server
angular-http-server copied to clipboard
Add simple proxy
Add's a simple proxy to the project. Proxy should be configured by adding a proxyConfig to your config file. For details view README.md #30
This looks rather cool. Let me take some time to review it. But could you first add some extra comments about what the use case is for the option - i just want to make sure we are on the same page
I have a couple of apps that will do an API request to they own host, in production cases the webserver wil proxy those requests to the web api's. This option wil mimic that behavior to make it possible to run those apps on this server. example: When my app starts it will do a request to /api-proxy/get-user-data which is proxied to the actual api. This simple proxy can be used to proxy those request to a mockserver so i can also use this server to spin up those apps
Hi there. I tried it out and hit a small issue. I want the server to run without having to worry about https, but if I don't use --https then your code uses http when it forwards requests, which will generally fail. I looked at how webpack do it and they provide an option to add protocol: 'http:' in their config. Do you think it would make sense to have it here.
(the problem is exacerbated by the fact that the --https option no longer seems to create assets that chrome will accept - not your problem, but it makes using your option harder. How do you use it?)
Hi there. I tried it out and hit a small issue. I want the server to run without having to worry about https, but if I don't use --https then your code uses
httpwhen it forwards requests, which will generally fail. I looked at how webpack do it and they provide an option to addprotocol: 'http:'in their config. Do you think it would make sense to have it here.(the problem is exacerbated by the fact that the
--httpsoption no longer seems to create assets that chrome will accept - not your problem, but it makes using your option harder. How do you use it?)
I Just pushed a change, which adds a protocol option to the config instead of listening to the --htttps option. When absent https will be the default
I tried to test again - see https://github.com/simonh1000/angular-http-server/pull/48 - and still cant get it to work. I've run into a cloudflare issue Direct IP access not allowed. My guess is that your branch is tuned to your use case, but I've learnt in my ftp packager that in the wide world of network communications all sorts of weirdness can happen.
I'm going to try to build a server on my machine and proxy to that.
one change that I tried that got me past the first error but not the second was
httpProxy.createProxyServer({
secure: false,
});
Any views on this?
I have now got it to work on my machine with a reasonable test case. There is the bug above but then we can merge
Cool, will merge and release a new version at the weekend