Comments (6)
Obviously, the emitted Content-Type header is preserved through the proxy, e.g.
https://proto.myopds.com/assets/mobydick.epub/about.xml
same as:
https://crossorigin.me/https://proto.myopds.com/assets/mobydick.epub/about.xml
content-type →application/xhtml+xml
from go-toolkit.
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.
from go-toolkit.
Oh yes, I see:
https://github.com/banux/webpub-streamer/blob/master/main.go#L48
n := negroni.Classic()
c := cors.New(cors.Options{
AllowedOrigins: []string{"*"},
})
n.Use(c)
PS: do you deploy webpub-streamer
via a Docker configured with Caddy?
from go-toolkit.
It is just a quick deploy on digital ocean, i just push a direct support for let's encrypt so no more caddy.
from go-toolkit.
@danielweck can you confirm that it's all good on your side now ?
from go-toolkit.
Re.:
7c8fadf
//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.
That's because in my particular case, the processing of the origin
header by the CORS Negroni plugin was "getting in the way" (during tests, my HTTP clients do not necessarily produce the required headers in their requests, yet I need responses always with the origin-allowed header):
https://github.com/rs/cors/blob/master/cors.go#L305
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
}
from go-toolkit.
Related Issues (20)
- Use absolute URIs in the streamer
- Output an OPDS 2.0 feed listing publications HOT 1
- Add support for subtitles HOT 1
- Use an array for roles in contributor HOT 1
- Incorrect TOC parsing, ignores empty hrefs with title, whitespaces in string titles
- webpub manifest JSON `spine` and `resource` lists of links should be mutually-exclusive / non-overlaping? HOT 1
- Demo link dead? (https://proto.myopds.com) HOT 1
- EPUB spread "portrait" is deprecated and not conform with JSON Schema
- Images are missing `height` `width` HOT 3
- Publications cannot be Unmarshalled
- Re-add comicrack metadata support in CBZ
- Creating a Docker container for `rwp` HOT 2
- Proposal to Add -v or --version Parameter to CLI Interface HOT 3
- (pub.Publication).Get when href contains anchors HOT 1
- [security good practice] GitHub Action workflow, secrets.GITHUB_TOKEN now restricted by default (was permissive) HOT 2
- Add ability to read raw compressed archive entries
- Remove leading slashes from relative HREFs
- Return pageNavigation instead of pageBreakNumbers when inferring metadata
- Add CBR support
- Add comic metadata support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-toolkit.