Trouble proxying http requests to localhost server using Ember
See original GitHub issueI’m trying to get HTTP requests to proxy to my local api server, which is running on port 3000 on my machine.
I’ve configured polly as such:
pollyjs: {
enabled: EmberApp.env() !== 'production',
server: {
apiNamespace: 'polly',
recordingsDir: 'recordings'
}
}
If I just start the app using ember s
then the api calls do not get proxied over to my local server. This isn’t suprising, since I haven’t told the app anywhere to do so. If I start the app using ember s -proxy=http://localhost:3000
then the ember app tries to forward the call to polly over to my local server, which obviously doesn’t exist and returns a 404:
http://localhost:4200/polly/Acceptance-Projects-Test_1427335148%2FList-of-Projects_1960582640/c7891a5bc919b6b46c122f196338f0b2?order=0
Looking at the documentation, I’m unclear how to get this working. Is there some sort of configuration I need to do in the express server created by polly on the ember app? Or did I just configure polly wrong in .ember-cli-build
?
Also I have a test app up with the code I’m using https://github.com/andrewcallahan/test-app
Thanks in advance! Really hoping to get this working!
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (1 by maintainers)
@NullVoxPopuli that is correct. If you are using the REST Persister (which it looks like you are), a server must be stood up to support the polly requests. You can follow the setup instructions here.
If you dont want recording/replaying, you will need to upgrade to
v1.0.0
that way you can addmode: passthrough
to your configuration which will pass through all requests that you havent manually intercepted.@kennethlarsen the windows issue should’ve been resolved by #32.