Skip to content

Support proxy to backend #1487

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

Merged
merged 12 commits into from
Aug 19, 2016
Merged

Support proxy to backend #1487

merged 12 commits into from
Aug 19, 2016

Conversation

mmrath
Copy link
Contributor

@mmrath mmrath commented Jul 29, 2016

Issue #889

@filipesilva @TheLarkInn Here is the implementation for further discussion. I don't think it is merge ready. Please let me know your feedback on the implementation.

Also need your help on the testing side. How do I approach testing? Any existing test cases I can refer to?

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@mmrath
Copy link
Contributor Author

mmrath commented Jul 29, 2016

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@mmrath
Copy link
Contributor Author

mmrath commented Jul 29, 2016

I think we should remove proxy and insecure proxy options.

@filipesilva
Copy link
Contributor

Can you include in the first comment a brief text description of your solution as well? It should help us review the code by giving it a overall summary.

In regards to testing I talked a bit with @TheLarkInn and one way that stood out was to have an additional server, proxy calls to it, and verify that we can get stuff from it. There might be better options but this one seemed sound.

This commit adds support to proxy backend. Proxy confguration would
support all the configuration mentioned at
https://webpack.github.io/docs/webpack-dev-server.html#proxy except
transforamtions done using functions.
Configuration should be added to a json file and file name(relative to
project root) should be passed as an argument to ng serve commnad

e.g `ng serve --proxy-config proxy.config.json`
@mmrath
Copy link
Contributor Author

mmrath commented Jul 31, 2016

@filipesilva @TheLarkInn I have added two test cases, open for your review.

@mmrath mmrath changed the title WIP: Support proxy to backend Support proxy to backend Aug 1, 2016
@TheLarkInn
Copy link
Member

Need to update branch and tests will run again.

@mmrath
Copy link
Contributor Author

mmrath commented Aug 3, 2016

@TheLarkInn Updated, all tests passed.

@allens
Copy link

allens commented Aug 9, 2016

@mmrath Thanks. I'm using your enhancement and it is working a well. It is essential for me, so it would be great to get this merged into the official branch soon.

Presumably the CI build will succeed now because of 5a9941e

@allens
Copy link

allens commented Aug 9, 2016

FWIW I agree about removing the proxy and insecure proxy options. They're pretty limited and are just adding to command line option overload.

@mmrath
Copy link
Contributor Author

mmrath commented Aug 15, 2016

@filipesilva @TheLarkInn One of the travis CI run appears to be a flaky.

@filipesilva
Copy link
Contributor

@TheLarkInn can you review?

@TheLarkInn
Copy link
Member

LGTM pending tests.

@mmrath
Copy link
Contributor Author

mmrath commented Aug 19, 2016

Thanks @TheLarkInn @filipesilva. All tests passed now.

@rogerfar
Copy link

@mmrath could you supply a bit of documentation for the readme? I've never worked with this and it's a bit confusing.

@filipesilva
Copy link
Contributor

@yesman85 there is some documentation in the wiki: https://github.com/angular/angular-cli/wiki/stories-proxy

@nikithaperuka89
Copy link

@filipesilva I am having issues with my proxy.config it works locally. However, when I deploy the application to dev environment the backend api call fails with a 404.

Here is my proxy.config.json:

"/rest/": {
"target": "http://backend-api",
"secure": false,
"pathRewrite": {
"^/rest/
": ""
},
"changeOrigin": true
}
}

package.json:
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
}

Please advice

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants