Skip to content

HMR host behind cookie authentication #20613

@iamriajul

Description

@iamriajul

Description

I'm using Coder to deploy apps. In coder workspace, every port is exposed with a subdomain, for example:
80-.coder.example.com (For web app, In my case it is Laravel server)
5174-
.coder.example.com (Vite HMR server)
These urls is behind stateful authentication which requires certain cookies to be sent, but when I hit 5174-****.coder.example.com directly from my browser I can visit the page, but when cross-site requests happens, loading 5174-****.coder.example.com script from 80-****.coder.example.com then the request to 5174-****.coder.example.com gets redirected to coder's authentication page due to the request doesn't carry the cookies needed for authentication.

Suggested solution

Possible solution is allowing the user to configure the value of crossorigin="use-credentials" attribute for the script tag generated by vite.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions