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

Allow setting custom headers #17

Open
Jos512 opened this issue Feb 23, 2017 · 0 comments
Open

Allow setting custom headers #17

Jos512 opened this issue Feb 23, 2017 · 0 comments

Comments

@Jos512
Copy link

Jos512 commented Feb 23, 2017

I'd like to use gulp-awspublish-router to set custom headers based on file patterns. For instance, the Link header allows for server push when using HTTP/2 (source and more info).

For custom headers like that one, the problem is two fold:

  • It seems there isn't a way to access the path of the file currently processed. We need that to create headers like
Link: </images/drucken.jpg>; rel=preload; as=image
  • It seems some filtering happens; setting Content-Type headers work, but a Link header fails. For instance:
"^.+\\.(?:js|css)": {
    cacheTime: 691200,      // 8 days
    gzip: true,
    headers:
    {
        "Link": "Test"
    }
}

Generates:

UnexpectedParameter: Unexpected key 'Link' found in params
    at ParamValidator.fail (I:\node_modules\aws-sdk\lib\param_validator.js:50:37)
    at ParamValidator.validateStructure (I:\node_modules\aws-sdk\lib\param_validator.js:77:14)
    at ParamValidator.validateMember (I:\node_modules\aws-sdk\lib\param_validator.js:88:21)
    at ParamValidator.validate (I:\node_modules\aws-sdk\lib\param_validator.js:34:10)
    at Request.VALIDATE_PARAMETERS (I:\node_modules\aws-sdk\lib\event_listeners.js:108:42)
    at Request.callListeners (I:\node_modules\aws-sdk\lib\sequential_executor.js:105:20)
    at callNextListener (I:\node_modules\aws-sdk\lib\sequential_executor.js:95:12)
    at I:\node_modules\aws-sdk\lib\event_listeners.js:74:9
    at finish (I:\node_modules\aws-sdk\lib\config.js:308:7)
    at I:\node_modules\aws-sdk\lib\config.js:324:9

(Creating a Content-Type: Test header works fine, on the other hand.)

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