-
Notifications
You must be signed in to change notification settings - Fork 4
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
penguin proxy does not seem to insert the autoreload javascript #11
Comments
Hello! Thanks a lot for those kind words. It really means a lot hearing people find value in my projects :) Regarding your problem: my bet is that your origin server does not properly set the penguin/lib/src/serve/proxy.rs Lines 123 to 126 in 37fc03d
The script is only injected if the content type is set to Is my guess correct? |
Yes your guess is 100% correct. Thanks a lot! I think what you could do additionally is check if the document starts with Now that I know that I should set that header for me it is more than fine to not change anything in penguin. If you want I could create a CR mentioning that this header is required in the readme. |
A common pitfall was that the origin server didn't set the Content-Type correctly, making Penguin not insert the reload script into HTML. The Content-Type header should be correctly set, but Penguin can improve user experience here anyway, by sniffing and checking if the body looks like HTML. Specifically: if the body looks like HTML, but there is no Content-Type header, we treat it as HTML and warn. If it looks like HTML but the Content-Type header says something else, we warn and treat it like non-HTML. Addresses #11
@dreuter I justed pushed some commits to If you want, you could test the new version with |
Since I now know to set the header, my application is doing it and But just to confirm, I reverted the commit setting the header and et voila,
The script is still in the response and everything is working perfectly. Thanks so much! I am closing the issue, but feel free to reopen it, if I have missed anything :) |
Neat, thanks for the quick test! Will release it later today then. (Edit: Released as 0.1.8 & 0.2.6) |
Hey :)
First of all I have to say I really love your project. I used it now in a couple of my personal projects as a static file server and have to say it works fantastic for that. Thanks so much, you have already saved me dozens of development hours.
I only encountered one "problem" so far. When I use
penguin proxy
it seems to not insert the autoreload script into my html.Is that on purpose? Do I do something wrong?
To double check I have saved the exact same html into a file and served that through penguin and then the javascript will be inserted, which leads me to believe that it has nothing to do with the actual html I send.
The workaround is simple, as I can just add the link to the javascript to my templates, but ideally I would like my service to not know about penguin (although that is also already not that easy because of the autoreload needing to be triggered "manually").
The text was updated successfully, but these errors were encountered: