Strapi Admin panel is not accessible after deployment/production

System Information
  • Strapi Version: 4.5.6
  • Operating System: Windows 10
  • Database: Postgress
  • Node Version: 16.19.0
  • NPM Version: 8.19.3
  • Yarn Version:

Hi all,
I am trying to deploy strapi on AWS EC2 instance.
I followed the guide on strapi deployment given on the site. I was kind of able to run strapi in production mode as you can see in the image below.

On the EC2 instance the address http://localhost:1337 works properly.Strapi is working fine and admin panel also is properly showing.
Now since I want to access it outside of EC2,I used IIS as reverse proxy on the address “EC2_public_ip/strapi” I get the issue in the image below.

The apis for both the js files in adminpanel image above in network tab shows 200 ok.
On the EC2 itself when I access the address “localhost/strapi” I get the same error. And also while I get this error the apis in strapi console log are showing ok status for all the calls like /admin and /init.
Below are the js files for reference.
server.js

middlewares.js

Things I have tried after some exploring-
1.Dowgraded nodejs version to 16.19.0(was using 18.13,actually in this 18.13 version I was not able to create the strapi project itself.
It was giving some vscode update ,python,gyp errors etc so i downgraded it to 16.19.0)
2.Tried nginx instead of IIS for reverse proxy but failed to do so.(However during some seetings I was able to get the loading
icon on admin panel but it stuck on loading only and was giving an error msg saying invalid url or something.)
3.Tried yarn,but it showed same error.

Would it not be incorrect to say localhost on the server, don’t you want to set the IP or URL for the instance you want to do.
Also I would suggest for the console error to delete build and .cache folder and rebuild the admin panel

I tried what you suggest. I delete the build and .cache folder and rebuild the admin panel still same error I am getting.

Did you solve this problem?