How to have both static server and proxy in grunt
See original GitHub issueHello,
I’m trying to setup a configuration in grunt that use a static server for frontend code and a proxy for backend REST API, I can make it work one or the other but not both at same time, it just fails silently.
Ideally I’d like to be able to setup routes or regex to dispatch between the static server and the proxy: by default go to static server and for /api and few other URIs go through proxy.
browserSync: {
dev: {
bsFiles: {
src : [
'src/main/webapp/**/*.html',
'src/main/webapp/**/*.json',
'src/main/webapp/bower_components/**/*.{js,css}',
'{.tmp/,}src/main/webapp/assets/styles/**/*.css',
'{.tmp/,}src/main/webapp/scripts/**/*.js',
'src/main/webapp/assets/images/**/*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
options: {
watchTask: true,
server: {
baseDir: [".tmp", "src/main/webapp"]
},
// proxy: "localhost:8080"
}
},
Issue Analytics
- State:
- Created 9 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Proxy Your Requests to the Backend Server With Grunt
The procedure to setup the Grunt proxy for backend requests is simple. First, you will have to add the proxy configuration to your...
Read more >Setup authenticated corporate proxy in Grunt server
I am starting to work on an existing Angular JS application, however I am unable to get it working behind the corporate proxy....
Read more >Using Grunt As Your Front End Dev Server | Greg Babiars's Blog
Grunt's wide range of makes it easy to create a dev server to both serve up our static files as well as proxy...
Read more >Browsersync + Grunt.js
First, you'll need to install the Browsersync Plugin. ... be watching CSS files and using the built-in server for static HTML/CSS/JS files. ......
Read more >Proxy Your Requests to the Backend Server With Grunt
The procedure to set up the proxy is simple. First, you will have to add the proxy configuration to your Gruntfile.js . In...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi,
I am using browser-sync with proxy-middleware.
My Proxy redirect some requests. I want to avoid the redirect of the url and also from http to https. How to achived that?
Here is my browserSync config task. The app checks to see if authentication is available, if not redirects to /auth page where user performs login. If the auth page is smart it redirects the user back to the original location, this time the auth cookie is present so starts calling /api. I haven’t done anything manually to add cookies, its behaving like it should in a production environment. I noticed one thing though, it doesn’t work over https but when I am running this locally, its all http.