Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Proxied replay prevents serviceWorker from functioning like on localhost #328

Open
machawk1 opened this issue Dec 12, 2017 · 2 comments
Open

Comments

@machawk1
Copy link
Member

The ServiceWorker that is included in the ipwb replay system requires either HTTPS or localhost (potentially using HTTP) to function by design.

When using Proxy mode and HTTP on localhost, the ServiceWorker ceases to register or function.

For example, in my /etc/hosts file I added a line:
127.0.0.1 myipwb
...which should map all traffic for the "host" myipwb to localhost. I then run:

ipwb index ipwb/samples/warcs/5mementos.warc | ipwb replay -P myipwb

and access http://myipwb:5000 in my browser. The console reports:
"ServiceWorker registration failed: DOMException: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV)."

This is expected because of the above but should be remedied or at least should provide the user with info of why their embedded mementos are not redirecting properly.


Also, with proxy mode, there may need to be port consideration when a proxied host is specified that does not contain this information. Perhaps 80/443 should be assumed or, as shown here, the default port propagated. This ticket is not about this facet.

@ibnesayeed
Copy link
Member

This is an expected behavior, which I won't call a bug. The requirement of HTTPS for non-localhost host names is independent of the proxy mode. This behavior can be seen with and without the proxy mode.

A warning message on the page can be added if the registration of the SW fails, but this can be caused by many reasons, hence, it should not necessarily be attributed to the proxy mode. Whatever is the reason of failure, the re-routing functionality will cease to work, so the message should be generic enough.

I would not worry about the presence or absence of the port number in the proxy URL. Directing traffic to the IPWB server instance using the supplied proxy URL is the responsibility of the person who configured and supplied the proxy URL.

@machawk1
Copy link
Member Author

Related resource https://github.com/FiloSottile/mkcert

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants