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

Support CORS headers #89

Closed
geoffwa opened this issue Jan 25, 2017 · 4 comments
Closed

Support CORS headers #89

geoffwa opened this issue Jan 25, 2017 · 4 comments

Comments

@geoffwa
Copy link

geoffwa commented Jan 25, 2017

It'd be awesome if the buildpack would support CORS headers.

Often when building a webapp there's a need to make a mock version of a particular API to fetch information from. For read-only APIs this can be done easily by nesting JSON files in directories and deploying this to some sort of static hosting service. This is a bit simpler than write a tiny express or sinatra app to server static content with the requisite CORS headers.

I imagine something along the lines of:

ENABLE_CORS=<Access-Control-Allow-Origin header value>

which would dump something like the following into the nginx.conf:

add_header 'Access-Control-Allow-Origin' '$ENABLE_CORS'
add_header 'Access-Control-Allow-Methods' 'OPTIONS, HEAD, GET'
add_header 'Access-Control-Allow-Headers' 'Origin,Referer,User-Agent,X-Requested-With,Date,Keep-Alive,Cache-Control,If-Modified-Since,If-None-Match,Range,Accept-Charset,Accept-Encoding'

(I just shotgunned a bunch of headers into Access-Control-Allow-Headers, it's not an exhaustive list)

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/138361463

The labels on this github issue will be updated when the story is started.

@sclevine
Copy link
Contributor

Story to add Staticfile option: https://www.pivotaltracker.com/story/show/136370663

@sclevine
Copy link
Contributor

sclevine commented Mar 1, 2017

We've decided not to include this feature in favor of the new location_include Staticfile option that allows you to specify a file containing arbitrary NGINX configuration. Check out the example app here: https://github.com/cloudfoundry/staticfile-buildpack/tree/master/cf_spec/fixtures/include_headers

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

4 participants