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

Add "X-Forwarded-Path" Header #4

Merged
merged 4 commits into from
Aug 31, 2016
Merged

Add "X-Forwarded-Path" Header #4

merged 4 commits into from
Aug 31, 2016

Conversation

wooliet
Copy link

@wooliet wooliet commented Aug 4, 2016

This update adds support for an "X-Forwarded-Root" header, which works
much the same as the "X-Forwarded-Host" header. The value provided will
be inserted in all href values as the root path.

For example:

> curl http://127.0.0.1:1337 -H 'X-Forwarded-Host: zetta.com' -H 'X-Forwarded-Root: api/v1'
"links": [
  {
    "rel": [
      "self"
    ],
    "href": "http://zetta.com/api/v1/"
  },
  {
    "title": "SEVERX",
    "rel": [
      "http://rels.zettajs.io/server"
    ],
    "href": "http://zetta.com/api/v1/servers/SEVERX"
  },
  {
    "rel": [
      "http://rels.zettajs.io/events"
    ],
    "href": "ws://zetta.com/api/v1/events"
  },
  {
    "rel": [
      "http://rels.zettajs.io/peer-management"
    ],
    "href": "http://zetta.com/api/v1/peer-management"
  }
],

William King added 3 commits August 4, 2016 16:49
This update adds support for an "X-Forwarded-Root" header, which works
much the same as the "X-Forwarded-Host" header. The value provided will
be inserted in all `href` values as the root path.

For example:

```
> curl http://127.0.0.1:1337 -H 'X-Forwarded-Host: zetta.com' -H 'X-Forwarded-Root: api/v1'
"links": [
  {
    "rel": [
      "self"
    ],
    "href": "http://zetta.com/api/v1/"
  },
  {
    "title": "SEVERX",
    "rel": [
      "http://rels.zettajs.io/server"
    ],
    "href": "http://zetta.com/api/v1/servers/SEVERX"
  },
  {
    "rel": [
      "http://rels.zettajs.io/events"
    ],
    "href": "ws://zetta.com/api/v1/events"
  },
  {
    "rel": [
      "http://rels.zettajs.io/peer-management"
    ],
    "href": "http://zetta.com/api/v1/peer-management"
  }
],
```
Option arg should be last.
Custom header changed from `X-Forwarded-Root` to `X-Forwarded-Path`.
All relevant variable names changed accordingly.

Per discussion here:
zettajs/zetta#320
@AdamMagaluk
Copy link
Contributor

+1

@AdamMagaluk AdamMagaluk changed the title Add "X-Forwarded-Root" Header Add "X-Forwarded-Path" Header Aug 31, 2016
@AdamMagaluk AdamMagaluk merged commit ba4f31f into argo:master Aug 31, 2016
@wooliet wooliet deleted the use-forwarded-root-header branch August 31, 2016 20:07
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

Successfully merging this pull request may close these issues.

2 participants