sproutcore / abbot

SproutCore Build Tools [deprecated]
http://www.sproutcore.com
88 stars 44 forks source link

Incorrect proxying behaviour #8

Closed enquora closed 13 years ago

enquora commented 13 years ago

Commit 40069a1bdea8a248eef274c402fd31b307215eca attempted to fix a problem (apparently) with static 404 responses not being proxied properly by loading the proxy handler after the main url routing code.

This now breaks routing for cases where the url to be proxied looks like /externalurl/something

See rack/service.rb: if project.buildfile.proxies.size > 0 and rack/builder.rb normalize_url() method

wagenet commented 13 years ago

Not sure how this would cause a problem. Unless I'm missing something, I'm using urls of that type without difficulty.

enquora commented 13 years ago

Currently, the code to load the Sproutcore index.html file over-rides any attempt to proxy URLs with just a single slash in them. This is a regression.

The use of a complex regex makes this non-obvious on first reading.

wagenet commented 13 years ago

enquora, you're saying you want to do proxy '/', :to => 'http://example.com'? Are you sure that behavior was ever explicitly supported? Or did it just work by accident?

enquora commented 13 years ago

Attempting to proxy /something?x=yada returns the SC index.html page. I don't see how we can easily set up a test case for this since it requires an active server. Couchdb users, for instance, will find that they cannot load individual documents using a REST api.

Please look at the code in rack.builder.rb -> normalize_url() and rack.service.rb

This behaviour must work if a functioning proxy is to be provided, irrespective of whether it previously worked or not. And it did.

This actually highlights the critical need for integration tests, which I'm considering.

wagenet commented 13 years ago

I have not heard any other complaints or concerns about this and I'm still not sure exactly what the issue is. If this is still an issue, please give me your specific Buildfile proxy setting and an example of the url you would like to call. This way I can easily test and reproduce the issue.