Comments (10)
I've following version in package.json
:
...
"grunt-contrib-connect": "~0.5",
"connect": "~2.9.0",
"grunt-connect-proxy": "~0.1.6"
...
from grunt-contrib-connect.
I've tried out and figured out that using query params in the URL is preventing the grunt-contrib-connect
from injecting the LR snippet into HTML
from grunt-contrib-connect.
I don't think this has something to do with connect-livereload
. Anyway, I would first make sure to take the latest version. I just noticed that grunt-contrib-connect
should be version 0.6.0.
from grunt-contrib-connect.
I've the latest version, still doesn't work.
from grunt-contrib-connect.
Hey @okonet, sorry for the slow response. I decided to look into this bug.
I have added a test to make sure the snippet is there .
See https://github.com/gruntjs/grunt-contrib-connect/blob/master/test/connect_test.js#L146
You will notice that the request is made using
headers: {
accept: 'text/html',
},
without the snippet doesn't get added. I also tested this in Firefox and Chrome. Hope this helps.
from grunt-contrib-connect.
Hey @vladikoff,
this is the headers from the request I make to my connect server:
Request URL:http://localhost:9000/?service=testscript&test=playing-a-game.json
Request Method:GET
Status Code:304 Not Modified
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,de;q=0.6,ru;q=0.4
Cache-Control:max-age=0
Connection:keep-alive
Host:localhost:9000
If-Modified-Since:Fri, 28 Mar 2014 15:23:41 GMT
If-None-Match:"10569-1396020221000"
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36
Query String Parametersview sourceview URL encoded
service:testscript
test:playing-a-game.json
Response Headersview source
Accept-Ranges:bytes
Cache-Control:public, max-age=0
Connection:keep-alive
Date:Fri, 28 Mar 2014 15:27:19 GMT
ETag:"10569-1396020221000"
Last-Modified:Fri, 28 Mar 2014 15:23:41 GMT
I can see the text/html
accept header there, but not sure if it should be the only one. The second question is: if so, how do I change this in my Gruntfile?
from grunt-contrib-connect.
Adding my bits here.
Observed that liveReload snipped doesn't get included when gzip is used.
The problem always reproduces when I turn gzip on using compression https://github.com/expressjs/compression as middleware.
from grunt-contrib-connect.
@vishwanatharondekar have you tried changing the order of the middleware so that connect-livereload
is called before compression
?
from grunt-contrib-connect.
Well. It did work but compression stopped working.
middleware: function (connect) {
return [
connect.static(appConfig.app),
compression(),
];
}
When I put the compression middleware after connect.static as mentioned in above code. liveReload appeared but compression didnt work.
Any specific reason for this behavior.
from grunt-contrib-connect.
Uuups, yes there is a reason for this behaviour. the connect-livereload
middleware rewrites res.write
, res.writeHead
and res.end
and stores the original versions.
var writeHead = res.writeHead;
var write = res.write;
var end = res.end;
When the middleware is loaded. When these functions are called at runtime connect-livereload
detects if the livereload script needs to be inserted, otherwise, the "old" stored function versions will be called.
Therefore any other middleware that rewrites these functions after the connect-livereload
middleware will be reverted at runtime, which is ugly and an open issue of connect-livereload
. Unfortunately, I still haven't found a way to fix this.
from grunt-contrib-connect.
Related Issues (20)
- ExperimentalWarning: The http2 module is an experimental API. HOT 6
- forwarding grunt connect to different url HOT 2
- DES3 is a weak cipher
- warning corifeus-builder-angular > grunt-contrib-connect > [email protected]: Use the built-in module in node 9.0.0 or newer, instead HOT 10
- Can I force TLS 1.2? HOT 2
- Can we use this with helmet? HOT 1
- Changing content type of files HOT 2
- Is it possible to configure the mime type returned by grunt-contrib-connect? HOT 1
- Options are just being ignored HOT 1
- This project's build is currently broken. HOT 1
- How to preview a Markdown file?
- Port parameter passed in as string leads to misleading error HOT 1
- Upgrade morgan package, CVE-2019-5413
- Cannot access Angular App hosted on CentOS 7 VM in Windows 10
- Security vulnerability GHSA-6fc8-4gx4-v693 affecting "ws" package (nested dependency) HOT 2
- opn dependency was renamed to `open` HOT 1
- `node-http2` is deprecated. Use node's built in `http2` HOT 6
- Fix vulnerability from websocket dependency: Denial of Service HOT 2
- IPv4 loopback overridden
- util.isArray API is deprecated after update node to version 22.0.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-contrib-connect.