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

Chop the protocol and hostport information off absolute URLs #6

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

domq
Copy link

@domq domq commented Jan 22, 2019

The http://localhost:3000/ part in e.g. http://localhost:3000/static/client/my/logo.svg tends to not work in very simple cases, such as
when accessing your development Meteor app through its IP address or
host name (e.g. http://1.2.3.4:3000/). Just chop it off, and trust the
browser to resolve e.g. /static/client/my/logo.svg relative to
whatever protocol, host and port the Meteor app was loaded from in the
first place.

I am not aware of any case where we would be worse off by doing this.

The `http://localhost:3000/` part in e.g.
`http://localhost:3000/static/client/my/logo.svg` tends to not work in
very simple cases, such as when accessing your development Meteor app
through its IP address or host name (e.g. `http://1.2.3.4:3000/`).
Just chop it off, and trust the browser to resolve e.g.
`/static/client/my/logo.svg` relative to whatever protocol, host and
port the Meteor app was loaded from in the first place.
@akanix42
Copy link
Owner

Thanks for contributing! I'll have to think about this a bit. I see your point, but there's at least one reason why I did it this way, and that's for ease of use when creating links to put in an email since the email won't know what domain it came from. I can't remember at the moment if there were any other reasons.

domq pushed a commit to epfl-si/wp-veritas that referenced this pull request Jan 24, 2019
I happen to think that
akanix42/meteor-static-assets#6 would be an
even better idea, but from its comment thread it's going nowhere fast.
domq pushed a commit to epfl-si/wp-veritas that referenced this pull request Jan 24, 2019
I happen to think that
akanix42/meteor-static-assets#6 would be an
even better idea, but from its comment thread it's going nowhere fast.
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

Successfully merging this pull request may close these issues.

2 participants