I have an Angular application and a landing page written in jQuery.
I want to serve the landing page every time the request is on the root of http://mywebsite.com
. Anything else, let's say http://mywebsite.com/otherpage
, I want to serve the Angular application.
With nginx
(production), this is fairly easy.
When developing Angular, we can easily proxy other requests, like /api
, with --proxy-config proxy.config.json
CLI option.
The problem I'm getting is with the root level.
What am I doing wrong? Can't I proxy the root level?
Angular docs tells us to go to Webpack dev-server docs, but still I couldn't figure out how to do it.
My proxy.config.json
is like the following:
{
"/api/*": {
"target": "http://localhost:3000",
"secure": false,
"logLevel": "debug"
},
"/": {
"index": "",
"target": "http://localhost:3000",
"secure": false,
"logLevel": "debug"
}
}
from Angular Proxy in root level
No comments:
Post a Comment