-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP CORS #1
Comments
Obviously, the emitted Content-Type header is preserved through the proxy, e.g. https://proto.myopds.com/assets/mobydick.epub/about.xml
|
Thanks for the return. I think Caddy with the cors module (https://caddyserver.com/docs/cors) overwrite the negroni cors middleware plugin. I will check tonight to use directly the ACME protocole or use another proxy. |
Oh yes, I see: n := negroni.Classic()
c := cors.New(cors.Options{
AllowedOrigins: []string{"*"},
})
n.Use(c) PS: do you deploy |
It is just a quick deploy on digital ocean, i just push a direct support for let's encrypt so no more caddy. |
@danielweck can you confirm that it's all good on your side now ? |
Re.: //https://github.com/rs/cors#parameters
c := cors.New(cors.Options{
AllowedOrigins: []string{"*"},
AllowedMethods: []string{"POST", "GET", "OPTIONS", "PUT", "DELETE"},
Debug: true,
})
n.Use(c) ...in another Go project, I also ended-up not using the Negroni CORS middleware plugin, and instead I "manually" set additional HTTP headers. Anyway, just as a heads-up, here's how I centralized the CORS headers in my Go code: n.Use(negroni.HandlerFunc(CORSHeaders)) func CORSHeaders(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
grohl.Log(grohl.Data{"CORS": "yes"})
rw.Header().Add("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
rw.Header().Add("Access-Control-Allow-Origin", "*")
// before
next(rw, r)
// after
// noop
} |
Just a heads-up: although your test server does not emit HTTP CORS headers (which would make sense, as a reading system app would most likely be hosted on a different domain, distinct from the content server's origin), you can use a proxy such as https://crossorigin.me , for example:
https://proto.myopds.com/manifest/mobydick.epub/manifest.json
vs.
https://crossorigin.me/https://proto.myopds.com/manifest/mobydick.epub/manifest.json
The text was updated successfully, but these errors were encountered: