superfly / edge

A set of useful libraries for Edge Apps. Run locally, write tests, and integrate it into your deployment process. Move fast and maybe don't break things? Because, gosh darnit, you're an adult.
https://fly.io
Apache License 2.0
142 stars 10 forks source link

[WIP] add squarespace backend #11

Closed ghost closed 5 years ago

ghost commented 5 years ago

The test case I added is still failing and I'm not sure why. :) Can I get a second set of eyes on it?

Related to #10

mrkurt commented 5 years ago

A 400 response probably means Squarespace doesn't like the combination of headers it's getting.

You can use curl to reproduce what the proxy function should be doing:

curl -D - -o /dev/null https://example.squarespace.com -H "Host: example.squarespace.com" -H "X-Forwarded-Host: example.squarespace.com" -sS

mrkurt commented 5 years ago

Ok, the 400 error was happening because we weren't sending a user-agent header in the tests. I added that.

Now it's legitimately not working, any requests through the CDN app to squarespace get redirected to example.squarespace.com/[session]. If you set the rewriteLocationHeaders option to true when it creates the proxy, it should take care of that.