ndmitchell / hoogle

Haskell API search engine
http://hoogle.haskell.org/
Other
738 stars 134 forks source link

Loading local hoogle page hangs on safari for a local server #382

Open santiweight opened 2 years ago

santiweight commented 2 years ago

Calling:

hoogle server

with apparently any configuration, causes the server to load, but the server can only be viewed from safari. Chrome works as expected...

Device: M1 Macbook Pro 2021 Safari version: Version 15.0 (17612.1.29.5)

Note that the static html seems to cross the wire, but the later api calls hang.

Output for the above scenario from the command line looks like:

Server started on port 8080
Reading log...0.00s
2022-01-13T17:20:07.607962 - Server starting on port 8080 and host/IP HostAny
/
2022-01-13T17:20:10.517875 ::1 0.003 /
ndmitchell commented 2 years ago

A lot of browsers have restrictions on what Javascript can run when spawned from a localhost URL - in the name of security. If Chrome works but Safari doesn't I'd look at the diagnostics and see if that gives any hint.

slice commented 1 month ago

Safari is able to load the landing page (/) but upgrades further requests to HTTPS, which hangs because the local server isn't serving over HTTPS of course. This might be because of the Content Security Policy specified by Hoogle, which says to upgrade insecure requests. I haven't actually verified if this is the root cause, but it seems that Safari is obeying this because the referenced resource URLs in the HTML begin with / and there would be no other reason to change the protocol used. It's interesting how other browsers don't have the same behavior, though.

theNerd247 commented 1 month ago

I'm having the same issue on my local machine as well. I've found running hoogle server --local -n fixes the issue