I have a PHP site https://example.com.
I have a MEAN stack application subdomain http://team.example.com. It uses APIs provided by nodejs on port 3000.
I’m facing a problem when running the application on http://team.example.com where the Nodejs API is not reachable .
added the following to Apache Config File:
ProxyPass /node/ http://localhost:3000/
I am sending api request from angular side with the following:
team.example.com/node/users/login
APIs reached successfully via postman , but fails on browser
How can I solve this problem?
2
Answers
I think you have CORS issue, I’m assuming that you are using express framework in your node service.
See the following sample code to know how to solve CORS issue for browser.
In above sample code you need to focus on following code lines:
For using the proxy you have to enable the proxy module in apache. After that restart the apache.
If you are using ubuntu os run following command
After this, you have to run