这是indexloc提供的服务,不要输入任何密码
Skip to content

feat: add origin config option #582

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

Merged
merged 5 commits into from
Feb 27, 2025

Conversation

pveierland
Copy link
Contributor

Checklist

Related issue

Fixes #232

Overview

This commit adds the origin as an optional configuration parameter that can be set in the same way as host and port.

This closes #232 and solves use-cases such as being able to develop on localhost with HTTPS with an origin name such as https://tuono.localhost, where HTTPS is required for testing certain web features (relating to e.g. storage or web workers).

Prior to this commit this will not work as the Vite tools will attempt to load resources from e.g. http://localhost:3000 and be blocked by the browser for attempting to load HTTP resources from an HTTPS web page.

@github-actions github-actions bot added typescript Requires typescript knowledge rust Requires rust knowledge labels Feb 20, 2025
@pveierland pveierland closed this Feb 20, 2025
@pveierland pveierland reopened this Feb 20, 2025
This commit adds the `origin` as an optional configuration parameter
that can be set in the same way as `host` and `port`.

This closes tuono-labs#232 and solves
use-cases such as being able to develop on localhost with HTTPS with an
origin name such as `https://tuono.localhost`, where HTTPS is required
for testing certain web features (relating to e.g. storage or web
workers).

Prior to this commit this will not work as the Vite tools will attempt
to load resources from e.g. `http://localhost:3000` and be blocked by
the browser for attempting to load HTTP resources from an HTTPS web
page.
Copy link
Member

@Valerioageno Valerioageno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Overall looks great.

Note: there is still a red pipeline for the rust part. Should be fixed with cargo fmt && cargo clippy

@marcalexiei marcalexiei changed the title feat: add origin config parameter feat: add origin config option Feb 21, 2025
@Valerioageno
Copy link
Member

@pveierland were you able to make it working on your end? I remember we had a thread on discord about a broken usage with it

@pveierland
Copy link
Contributor Author

Yes, this PR has solved my issues with use of HTTPS during development. There may be other possible improvements to make later, however this PR alone should make normal use-cases work.

Copy link
Collaborator

@marcalexiei marcalexiei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.
I just found out that the create json config tests are not correct.
I'm going to fix this on main

Copy link
Member

@Valerioageno Valerioageno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking over @marcalexiei

@Valerioageno Valerioageno merged commit 1ba9423 into tuono-labs:main Feb 27, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust Requires rust knowledge typescript Requires typescript knowledge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request]: Add ability to set server.origin to fix CORS with Vite
3 participants