Closed MyrionPhoenixmoon closed 8 years ago
Yes, precisely there it is written that one should include embed.min.js into the page. However, it is never mentioned where this embed.min.js comes from. My site/js/embed.min.js was not magically pointing at isso's site-packages!
Maybe I am missing something but where in the documentation is it written that insso-install-folder/lib/python2.7/site-packages/isso/js needs to be served up? I had to copy the contents of that folder into my /var/www/.
Or perhaps something went wrong when I used pip install and those files should have been in a much more obvious place. Even then, document where they are supposed to be and it would have been immediately obvious that something went wrong on my side.
There is no need to extract the JS and serve it manually. Isso does this, too. If you want to maintain a separate javascript file for Isso, go ahead. It will break with the next release.
I faced the same situation and manually copied that to issopath/js/ Actually isso won't automatically async the embed.min.js for me either. @posativ
What part of
<script data-isso="//comments.example.tld/"
src="//comments.example.tld/js/embed.min.js"></script>
is unclear? data-isso
is actually a prefix if the src for the JavaScript file. Manually serving the JavaScript is not supported by Isso.
That's the code I use and certainly when curling the js url it'll show the code but if I don't manually copy embed.min.js to that path the js url will actually return a 404 error. So I wonder if that could be done automatically?@posativ
That's the code I use and certainly when curling the js url it'll show the code but if I don't manually copy embed.min.js to that path the js url will actually return a 404 error. So I wonder if that could be done automatically?@posativ
The 'embed.min.js' part. I didn't know that isso created or served such a file.
Plus, my isso runs on a non-public port. I wouldn't have guessed that I need to request localhost:1234/js/embed.min.js, since that's not served by my webserver or reachable from the client.
Whatever setup you use, if you proxy the Isso API, you also proxy the JavaScript and CSS.
That's not my case it only proxy the isso. The only js available is what I copied https://babybic.hu/isso/js/embed.min.js Yep the isso url is https://babybic.hu/isso/ U could get a 404 error when u access https://babybic.hu/isso/js/count.min.js
So everything should be public after all? That contradicts another part of the documentation. And really it would just be much clearer if it said somewhere that isso also creates and serves that file or that this file must be publicly reachable...
@BabyBichu did you install Isso from GitHub?
@posativ I installed using pip3
Then your nginx configuration is incorrect. Isso will correctly serve the CORS header on e.g. https://babybic.hu/isso/js/foobar
but if it ends with .js
, your nginx configuration ignores Isso, check:
~> curl -Is https://babybic.hu/isso/js/asd.js
HTTP/1.1 404 Not Found
Server: nginx
Date: Tue, 30 Aug 2016 11:56:32 GMT
Content-Type: text/html
Content-Length: 3426
Connection: keep-alive
Vary: Accept-Encoding
ETag: "57b53862-d62"
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
~> curl -Is https://babybic.hu/isso/js/asd.lala
HTTP/1.1 404 NOT FOUND
Server: nginx
Date: Tue, 30 Aug 2016 11:56:36 GMT
Content-Type: text/html
Content-Length: 233
Connection: keep-alive
Access-Control-Allow-Origin: https://babybic.hu
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: HEAD, GET, POST, PUT, DELETE
Access-Control-Allow-Headers: Origin, Referer, Content-Type
Access-Control-Expose-Headers: X-Set-Cookie, Date
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
@MyrionPhoenixmoon if I control the HTTP endpoint, then it doesn't matter. If you override certain endpoints for the prefix, e.g. /isso
and images/css/js, it won't work. This is not Isso's fault. I can't control the HTTP proxy.
location /isso { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Script-Name /isso; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://localhost:1234; }
That's my configuration in the nginx file. Wondering what's wrong with it
You have more in your nginx configuration than this. That is the issue.
I'll doublecheck my config tonight and see if I can get Apache to proxy /isso the way isso needs it. Either way, I feel that it needs to be written down in the documentation that isso serves up javascript files itself.
@MyrionPhoenixmoon send a PR. Web server configuration is not part of Isso though. The sample configuration in the documentation works, what you add to this configuration is no longer Isso's problem.
@posativ maybe that's due to the line:
root /var/www/babybic.hu
So how to prevent the proxy from being influenced
@BabyBichu the curl request shows, that you have special handling for static files.
@posativ ok will try deleting it and curl that one
Oh for sure. I'll see if I can make a PR with a sample Apache config and the two or three sentences about js that I feel are needed.
@posativ I deleted the folder isso and curled but it still returns 404!
Why did you delete a folder? There is a directive in your nginx configuration, that adds special handling to assets, e.g. caching.
@posativ Wondering what's wrong with the conf:
server {
listen 443 ssl http2;
ssl_certificate /usr/local/nginx/conf/ssl/babybic.hu.crt;
ssl_certificate_key /usr/local/nginx/conf/ssl/babybic.hu.key;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!DSS:!PKS;
ssl_session_cache builtin:1000 shared:SSL:10m;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 5s;
server_name babybic.hu www.babybic.hu;
access_log /data/wwwlogs/babybic.hu_nginx.log combined;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
index index.html index.htm index.php;
include /usr/local/nginx/conf/rewrite/none.conf;
root /data/wwwroot/babybic.hu;
if ($host != babybic.hu) {
rewrite ^/(.*)$ $scheme://babybic.hu/$1 permanent;
}
location /isso {
proxy_set_header X-Forwarded-For$proxy_add_x_forwarded_for;
proxy_set_header X-Script-Name /isso;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:1234;
}
error_page 403 404 500 502 503 504 /error.html;
location = /error.html {
root /data/wwwroot/babybic.hu;
internal;
}
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
# Discourage deep links by using a permanent redirect to home page of HTTPS site
#return 301 https://$host;
# Alternatively, redirect all HTTP links to the matching HTTPS page
return 301 https://$host$request_uri;
}
There is a directive in your nginx configuration, that adds special handling to assets, e.g. caching.
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
@posativ Thanks! It now works like charm! Just deleted the |js
Okay, so in my case there were two issues:
1 I didn't need data-isso at all and 2 Always specify paths to proxy with a trailing slash.
I'll get to work on a PR the day after tomorrow, most likely.
@BabyBichu good to hear! I wonder why Nginx uses the regex location instead of a simple prefix, but I can't really make a order from this statement here (except: the longer the better). http://nginx.org/en/docs/http/ngx_http_core_module.html#location
@posativ I will optimize it in my leasure time. Anyway thanks for ur timely and detailed help!
@posativ I see, the “/documents/document.html” request will match configuration C. So If I use
location /documents/ {
expires 30d;
access_log off;
}
It'll cache all the files under /documents/ for 30 days. Is that correct?
I just set up isso for my blog and ran into an issue with the documentation.
You mention embedding embed.min.js into the website, but you never once mention where it's from.
Since I already new about the Embed.js library I got the code from that library and called that up.
Lo and behold, nothing happened.
Luckily I found a blog (in french) which mentioned copying js files from isso/lib/python2.7/site-packages/isso/js into Apache's directories led me onto the straight path.
I therefore believe that it is necessary to include this into the documentation. I can probably produce a Pull Request, if it would help, even though I haven't worked with Sphinx before.