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

url scheme should be made available on page object #1193

Closed
kamholz opened this issue Apr 23, 2021 · 1 comment
Closed

url scheme should be made available on page object #1193

kamholz opened this issue Apr 23, 2021 · 1 comment

Comments

@kamholz
Copy link

kamholz commented Apr 23, 2021

In my application, I automatically detect expired JWT access tokens and redirect to /refresh_token?redirect=..., where the redirect parameter is the page the user just tried to access. I wrote this function to generate the redirect URL:

export function pageUrl(page) {
  let url = `http://${page.host}${page.path}`;
  if (page.query.values().next().done) { // no query params
    return url;
  } else {
    return url + '?' + page.query.toString();
  }
}

Unfortunately the URL scheme has to be hardcoded here, because it isn't available on page. It would be nice to include it -- is there some reason that wouldn't be practical?

@kamholz kamholz changed the title url scheme should be made available url scheme should be made available on page Apr 23, 2021
@kamholz kamholz changed the title url scheme should be made available on page url scheme should be made available on page object Apr 23, 2021
@Conduitry
Copy link
Member

We don't have access to this on the server, because even if the site is, say, running with the Node adapter and is being served over HTTPS, that's handled by a proxy living in front of the SvelteKit app, which is always serving HTTP.

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

2 participants