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

Should kit.host be replaced with something like kit.base? #1241

Closed
hgl opened this issue Apr 27, 2021 · 3 comments
Closed

Should kit.host be replaced with something like kit.base? #1241

hgl opened this issue Apr 27, 2021 · 3 comments

Comments

@hgl
Copy link
Contributor

hgl commented Apr 27, 2021

Is your feature request related to a problem? Please describe.
This expends on #1240 to discuss the protocol value.

An obvious choice might be introducing kit.protocol, but that feels awkward.

Describe the solution you'd like
A cleaner solution might be something that is basically protocol + host, e.g., kit.base, and svelte kit should extract host from it.

If kit.base doesn't contain the protocol, it's inferred from svelte kit being in https mode or not.

page can also contain a protocol property in addition to host

As for kit.hostHeader, I think it can be left as it is, but we might need to introduce a kit.protocolHeader that can take a value like 'X-Forwarded-Proto'.

I don't feel strongly about the naming, just my two cents.

Describe alternatives you've considered

How important is this feature to you?
Not very, but nailing this down before 1.0 can be beneficial, since this is likely a breaking change.

Additional context

@Conduitry
Copy link
Member

Conduitry commented Apr 27, 2021

See #1193. We don't have access to whether the app is being served over HTTPS in production. And --https is adev- and preview-only thing. If you want to trust the x-forwarded-proto value, you can already expose it in the session.

@hgl
Copy link
Contributor Author

hgl commented Apr 27, 2021

Ah, makes sense.

But I think svelte kit doesn't have to be absolutely accurate when it comes to determining the protocol, as long as users can specify it manually in the config.

When the user doesn't specify one, assuming http by default and https when --https is used in dev/preview sounds like a pretty intuitive convention to me.

P.S., a tangent question, maybe node adapter can support https in the future? By that I mean the built app is able to run in https by itself. I'm asking because that sounds like another place where svelte kit can reasonably infer the protocol.

@hgl hgl changed the title Should kit.host be replaced something like kit.base? Should kit.host be replaced with something like kit.base? Apr 27, 2021
@Rich-Harris
Copy link
Member

Closing this as it can't be solved without additional configuration that is best expressed in userland. adapter-node could support https in future, but it's more conventional to put the server behind a reverse proxy

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

No branches or pull requests

3 participants