1

I have an angular js application which is serving from a node server which is running a at locahost:8050. It's running fine when I hit localhost:8050. But I want that request will come to localhost:8050 through a proxy, so I have set up nginx like below:

server {
    listen 80;
    server_name ingl.sorc.com;
    location /portal/gen/ {
        proxy_pass http://localhost:8050;    
        }
} 

and also make 127.0.0.1 ingl.sorc.com entry to the etc hosts file.

So when I am hitting ingl.sorc.com/portal/gen/ this URL it shows a blank page. It shows blank page because it try to get css and js file from "http://ingl.sorc.com/styles/vendor.a31e3c2d.css" and "http://ingl.sorc.com/styles/vendor.st34hj.js", those file eventually not exists in the particular path.

I am using grunt to build angular application. After build the application in index.html css and js are added to the page using relative path. For example :

<link rel="stylesheet" href="styles/main.46a5c195.css">
<script src="scripts/vendor.7925e705.js"></script>

Please help me. I have no idea how can I solve the problem.

1 Answer 1

1

You need to add a valid entry for styles. Try something like

server {
    listen 80;
    server_name ingl.sorc.com;
    location /portal/gen/ {
        proxy_pass http://localhost:8050;    
    }
    location /styles/ {
        # you'll have to find the right path 
        proxy_pass http://localhost:8050/styles; 
    }    

} 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.