Skip to content
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

Possible to set headers when using this module? #59

Closed
zacanger opened this issue May 10, 2017 · 1 comment
Closed

Possible to set headers when using this module? #59

zacanger opened this issue May 10, 2017 · 1 comment

Comments

@zacanger
Copy link

zacanger commented May 10, 2017

I'm looking to do something like the following (using koa-router):

router.all('*', async (ctx, next) => {
 assets.forEach((a) => { ctx.append('Link', `<${a}>; rel=preload;`) })
 // call staticCache(publicDirectory, otherOptions)
}

(where assets is some JS and CSS) but don't see a clear way to do this. Is that a possibility currently? What I'm currently doing can be seen here. This just gets a shape like [ { headerName: 'headerValue' } ].

I'm trying to avoid adding a separate middleware before staticCache — I'm trying to control headers only for things that happened to also be served by this middleware.

@zacanger zacanger changed the title Possible to pass headers through? Possible to set headers when using this module? May 10, 2017
@zacanger
Copy link
Author

I found a workaround that works for my use-case, so I'll close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant