Two Laravel setup issue on same server - laravel

I have setup two laravel project on same server, i.e. localhost. First one is for web interface and another for Webservices. I have created database connection on WebServices setup. I am running web interface without database. I am unable to access webservices setup via web interface, while when I setup web interface on another server, its working fine.
Please help me to fixed this issue....

Hmm, your issue could be regarding to CORS, but if you say that in different servers works fine, well, anyway, try configuring CORS in your web services by adding the following dependency:
composer require barryvdh/laravel-cors
Hope you solve!

Related

How to configure SSL on Spring Boot - Angular app on EC2 instance

I can't get my backend to send data after switching to secure connection.
I was able to successfully configure SSL with ssl_mod on Apache web server that serves my Angular app on AWS Linux 2 instance, the site is secure - but my Spring Boot backend is not responding, it is not sending any data. When I additionally convert .crt and .key files to PK12 that Spring understands and I use it in Spring app - I get this error:
net::ERR_SSL_PROTOCOL_ERROR
I've tried using AWS Load Balancer, but same thing happens, frontend is loaded in secure environment, but backend is not sending any data even after I change backend calls from http to https://my-site.com. I've tried following documentation and added this to my backend app properties file:
server.tomcat.remoteip.remote-ip-header=x-forwarded-for
server.tomcat.remoteip.protocol-header=x-forwarded-proto
and security configuration upgraded with this:
http.requiresChannel().anyRequest().requiresSecure()...
but to no avail.
Lastly, I created a new instance on EC2 and this time I didn't configure apache for the frontend on linux, I just used SSL certificate on my backend app with following properties:
server.ssl.enabled=true
server.ssl.key-store=/etc/ssl/mydomain_com.p12
server.ssl.key-store-password=******
server.ssl.key-alias=mydomain
To no avail, now my site doesn't load at all. I'm despearate, struggling with this for a week now. What is the procedure for a full stack app? How do I do it?
Let me respond because on the same day I asked the question - I found a solution. The solution was - converting free SSL certificate with the help of this website:
https://www.sslshopper.com/ssl-converter.html
After I've plugged it in my Spring Boot app - it works. Before that, I made the conversion with OpenSSL on Windows, and it seems it was faulty. I'm so happy now... I read so many articles on this website on my one and a half year journey of learning to code - and got stuck on the last step. I'm so happy. Thank you all for this amazing website and all the help. I love you! I'm proud of being a part of this programming community... the best humor, the best people!
Peace

how to develop/test angular in spring boot without building it

Maybe someone call help me to find a solution.
I have an angular app in a different folder of my git project.
Normally i use ng serve and open the frontend on its dedicated port.
I start the spring boot app on its own port and set a CORS filter to allow it.
However now that we are testing OAUTH i would like the frontend to be served be backend.
My problem is that ng serve is in memory and i dont know what would be the best option to include them into the backend.
I have tried to build them into the backend and then rebuild with mavent but that takes way to long for every small change on the frontend.
You may use a proxy which forwards requests to APIs or UI based on the Path. Something like
http://localhost:8888/api ---> [Proxy Server (localhost:8888)] ---> Spring Boot API (http://localhost:8080
http://proxy-domain.com:proxy-port/ui ---> [Proxy Server (localhost:8888)] ----> Angular App (http://localhost:4200)
For the proxy server, you can use free tools like Fiddler and have a rule there to route based on the URL patters (/api or /ui)

API call within a Web API fails

I am working on a web api backend.
I am trying to make a call to another web api from within one of our api controllers.
When I run this as a unit test it works fine.
However, when it is hosted on IIS Express the GetAsync call fails with the exception: "No connection could be made because the target machine actively refused it 127.0.0.1:8888".
When we host it on azure we also get a similar exception.
Is there a setting in our web.config missing?
Any suggestions?
looks like it is still pointing to local host, needs to point to IIS or Azure server.
Check for hardcoded values in test code or web config.

Laravel won't route on production server

Just getting started with laravel and have run into some trouble.
Before committing to using laravel I wanted to build a very basic web app to test the waters via homestead and then move that web app to a remote server in order to see how easy the process was.
So I've got homestead up and running and have built a very basic web app and it works perfectly locally.
However when I moved the laravel project onto the remote server the routing stopped working.
For example locally testProject.dev/contact takes me through to a mock 'contact us' view. However when I try that on productionServer.com/contact I'm greeted by a 403 'you do not have permission to access contact on this server'.
Am I missing something in laravel here or is this an issue with the sever setup?
Any help would be greatly appreciated. Thanks
Update -> This turned out to be an issue with another piece of software running on the server. Thanks for all the help.

Spring OAuth2 Provider Client Authentication 401 not authorized error using CloudFoundry as client

This question is primarily for the CloudFoundry developers. Has something changed that would make a client application using spring social unable to use basic client authentication to communicate with my core application hosting an oauth2 provider? When I run the client application on a tomcat server everything works. It also worked on a cloudfoundry microinstance about 2 weeks ago. Now I get a 401 unauthorized error making a call to the service at "../oath/token" on my core application. To see what I am referring to, my application is http://www.metroseattlegamers.com If you click the "Games" link at the top it brings you to a separate application. If you sign in using the application at http://gamerepository.metroseattlegamers.com, the "sign in with metroseattlegamers account" button uses custom spring social code to communicate to my spring oauth2 provider code at http://www.metroseattlegamers.com. That all works fine because it is running on two separate tomcat servers on different machines. However, I tested and wrote everything using cloudfoundry micro instances to run client apps. As I said, it was working about a week or two weeks ago. Now I get a 401 error when I run the client on a cloudfoundry instance. Everything still works great when I run two separate tomcat servers on separate machines. Rather than include a bunch of code, I am just curious if anything has changed with how cloudfoundry microinstances work in the last week or two that may have caused this problem.
No as far as I know. Would it be possible for you to file a ticket at the official support page: http://support.cloudfoundry.com. There you can get a private agent to assist and maybe share the implementation of your app to further debug. You will need to sign in by the account you registered on www.cloudfoundry.com.

Resources