Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • N Nomad
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • 小 白蛋
  • Nomad
  • Repository
Switch branch/tag
  • nomad
  • command
  • agent
  • http.go
Find file BlameHistoryPermalink
  • Mahmood Ali's avatar
    Allow UI to query client directly · 5a0826fd
    Mahmood Ali authored Nov 11, 2019
    Nomad web UI currently fails when querying client nodes for allocation
    state end endpoints, due to CORS policy.
    
    The issue is that CORS requests that are marked `withCredentials` need
    the http server to include a `Access-Control-Allow-Credentials` [1].
    
    But Nomad Task Logs and filesystem requests include authenticating
    information and thus marked with `credentials=true`[2][3].
    
    It's worth noting that the browser currently sends credentials and
    authentication token to servers anyway; it's just that the response is
    not made available to caller nomad ui javascript.  For task logs
    specifically, nomad ui retries again by querying the web ui address
    (typically pointing to a nomad server) which will forward the request
    to the nomad client agent appropriately.
    
    [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
    [2] https://github.com/hashicorp/nomad/blob/101d0373eec5d58761d05e67e03f38916997a6d2/ui/app/components/task-log.js#L50
    [3] https://github.com/hashicorp/nomad/blob/101d0373eec5d58761d05e67e03f38916997a6d2/ui/app/services/token.js#L25-L39
    5a0826fd

免费DevSecOps平台,让您的项目体验完整的DevSecOps流程,让项目更安全