RasaHQ / carbon-bot

Apache License 2.0
42 stars 31 forks source link

Update carbon bot tracking URL to point to assets.rasa.com; ideally create serverless function #36

Closed lunelson closed 3 years ago

lunelson commented 3 years ago

As discussed with @JEM-Mosig and mentioned in thread with @amn41, the page at rasa.com/carbon is potentially no longer working, and in any case I'd like to decouple these kinds of secondary functions from the main-website repo and deployments.

I have moved the HTML page to http://assets.rasa.com/other/carbon/index.html for now but ideally I'd recommend doing this using a serverless function which would deploy from that same project on a path like http://assets.rasa.com/functions/carbon-bot-tracking

The relevant code seems to be this:

https://github.com/RasaHQ/carbon-bot/blob/4218bc6d22230f6a85dd957e6b91be9f7f247782/actions.py#L267

amn41 commented 3 years ago

@lunelson thanks! Sorry for being a frontend noob, but can I do a serverless function that generates a redirect? I'm not sure how that would work

lunelson commented 3 years ago

@amn41 Ah yes, I didn't look closely enough, I was looking at the POST request and not noticing that window.location also gets replaced. It might be possible to do it with a serverless function if I return the right headers, but I'd have to test it; found these references:

How to do a 301 redirect from an AWS lambda function GorillaStack/serverless-redirect-example: Example of how to implement redirects in the Serverless framework

In the meantime though, I could just set up a 301 redirect to the new page...