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

Modifying Access-Control-Expose-Headers from within foxx service results in doubled header #2159

Closed
2 tasks done
clamor opened this issue Nov 8, 2016 · 2 comments
Closed
2 tasks done
Labels

Comments

@clamor
Copy link

clamor commented Nov 8, 2016

my environment running ArangoDB

I'm using the latest ArangoDB of the respective release series:

  • 3.1

On this operating system:

  • docker - official docker library

Foxx

I attached an angular based WebGUI for CRUD ( https://github.com/marmelab/ng-admin ) to a arangodb foxx service. That works fine, as long as the gui files are served directly from within arangodb.

When the gui is moved to another server, I have to modify Access-Control-Expose-Headers in the response to allow a X-Total-Count header in the response. Setting the x-total-count header for the reponse works fine from within router.get(... but I did not manage to modify the access-control-expose-headers to allow the x-total-count. Any hints where I can change this?

And btw., thanks for your great product.

jsteemann added a commit that referenced this issue Nov 9, 2016
do not overwrite CORS response headers set by Foxx application with hard-coded default values
jsteemann added a commit that referenced this issue Nov 9, 2016
do not overwrite CORS response headers set by Foxx application with hard-coded default values
jsteemann added a commit that referenced this issue Nov 9, 2016
jsteemann added a commit that referenced this issue Nov 9, 2016
@jsteemann jsteemann modified the milestones: 3.0.12, 3.1.1 Nov 9, 2016
@jsteemann
Copy link
Contributor

It looks like the Access-Control-Expose-Headers response header is always overwritten by the server code when the response is sent. Foxx apps currently cannot set it to a different value than the hard-coded one shown above.
I have submitted a fix for this which allows setting the header to a different value, by simply using res.headers["access-control-expose-headers"] = ... as for any other HTTP response header.
The fix has been pushed into 3.0, 3.1 and devel branches and will be included in the next releases (3.0.12, 3.1.1).

@jsteemann jsteemann added the 2 Fixed Resolution label Nov 17, 2016
@clamor
Copy link
Author

clamor commented Nov 21, 2016

Works like a charm. Thank you.

@clamor clamor closed this as completed Nov 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants