PostHog / posthog.com

Official docs, website, and handbook for PostHog.
https://posthog.com
Other
404 stars 412 forks source link

The Caddyfile page doesn't have (quite the) right info on CORS #9030

Open pauldambra opened 1 month ago

pauldambra commented 1 month ago

See https://posthoghelp.zendesk.com/agent/tickets/16092

The solution for them was

[ph.customer.eu](http://ph.customer.eu/) {
        header {
                Access-Control-Allow-Headers *
                Access-Control-Allow-Methods *
                Access-Control-Allow-Origin https://customer.eu/
        }
        @options {
                method OPTIONS
        }
        respond @options 204

        handle /static {
                reverse_proxy [https://eu-assets.i.posthog.com:443](https://eu-assets.i.posthog.com/) {
                        header_up Host [eu-assets.i.posthog.com](http://eu-assets.i.posthog.com/)
                        header_down -Access-Control-Allow-Origin
                }
        }
        handle {
                reverse_proxy [https://eu.i.posthog.com:443](https://eu.i.posthog.com/) {
                        header_up Host [eu.i.posthog.com](http://eu.i.posthog.com/)
                        header_down -Access-Control-Allow-Origin
                }
        }
        log {
                output file /var/log/caddy/my-disk/phCaddy.log {
                        roll_size 500mb
                }
        }
}

I (someone) needs to make time to check if that's very specific to their setup or we need to improve the docs here

pauldambra commented 1 month ago

(@fuziontech strikes me as knowing enough about caddy that he might be able to shortcircuit this 😊)