Open Closed

ServiceProxyScript Not Loading in separate URL #9558


User avatar
0
HadiLoghman created

Hi Team,

We’ve deployed a layered application using ABP. The frontend is implemented in Angular and both the Angular application and the HttpApi.Host (API backend) are hosted on IIS.

  • The Angular frontend is hosted at: client.StageDomain.com
  • The API (HttpApi.Host) is hosted at: client.StageDomain.com/api

After deploying the API under the /api path on the same domain, we encountered the following issues:

  1. The template switcher is not working
  2. Change Password functionality fails
  3. Several other features are not working as expected, seemingly due to the /api path and the ServiceProxyScript not being loaded

We reviewed the ABP IIS Deployment documentation, but it appears the guidance assumes separate domains or subdomains for each app component.

Thanks,


5 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • The issue is caused by the Angular frontend being hosted at the root (client.StageDomain.com) and the API (HttpApi.Host) being hosted under a sub-path (client.StageDomain.com/api). ABP's ServiceProxyScript and other dynamic endpoints (like /Abp/ServiceProxyScript and /Abp/ApplicationConfigurationScript) are expected at the root of the API application, but when hosted under /api, the Angular app tries to load them from /Abp/ServiceProxyScript instead of /api/Abp/ServiceProxyScript.

    • This results in 404/500 errors and MIME type issues, as seen in your console logs, because the requests are routed incorrectly or the server returns an HTML error page instead of the expected JavaScript.

    • ABP's official documentation and templates assume that the API is either on a separate domain/subdomain or at the root of a site, not under a sub-path like /api. Hosting the API under a sub-path is not officially supported and leads to these issues.

    • To resolve this:

      1. Host the API (HttpApi.Host) on a separate subdomain (e.g., api.StageDomain.com) or at the root of a different site.
      2. Update your Angular environment and appsettings.json to point to the correct API root URL.
      3. If you must use a sub-path, you would need to customize the Angular app and possibly the ABP backend to ensure all dynamic script and API URLs are prefixed with /api, but this is not recommended and not officially supported.
    • For more details, see the official IIS deployment documentation:

      • https://abp.io/docs/commercial/latest/startup-templates/application/deployment-iis?UI=NG&DB=EF&Tiered=No
    • In summary: Move your API to a root or subdomain, not a sub-path, for full ABP functionality.

    Sources:

    • https://abp.io/docs/commercial/latest/startup-templates/application/deployment-iis?UI=NG&DB=EF&Tiered=No

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    HadiLoghman created

    The issue doesn't appear to be related to the ServiceProxyScript, as we’re encountering the same error locally as well. We encountered this error for Password change too. This issue happens for all Profile menu items

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi, do you have any specific configuration in your web.config file that causes this problem? (Also, please check: https://abp.io/docs/latest/solution-templates/layered-web-application/deployment/deployment-iis?UI=NG&DB=EF&Tiered=No#rewrite-for-getenvconfig)

  • User Avatar
    0
    HadiLoghman created

    Hi EngincanV, thanks for reaching out. As I mentioned earlier, our application is .NET Core-based and uses appsettings.json for configuration. Our web.config is minimal and doesn’t include any specific context-related settings. The only notable difference compared to our local environment is that the SelfUrl and Authority in appsettings.json include an additional /api suffix, whereas the AngularUrl does not. This is the only configuration difference we've identified so far. Maybe this helps as well, when I try to change the layout of the website, I get some unexpected results on the staging site. Interestingly, on the first refresh, the website loads normally.

    After selecting a different layout After refreshing

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you try to add UsePathBase("/api") to your API website?

    app.UsePathBase("/api");
    app.UseRouting();
    
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on July 11, 2025, 11:35