Azure API Management does not return formatted HTML content

Vikhyath Shetty 25 Reputation points
2024-02-08T18:18:45.6433333+00:00

I am using API Management in Azure and I have backend that returns only HTML response. When I try to access the website directly I am able to view a well formatted HTML page, but after onboarding the backend to API GW when I try to access the website through the API GW I see that lot of formatting is missing. Is there anything that I can do in the policies to receive a well formed HTML without any missing tags? Also, is API GW the right fit here? Do I have to explore using any other service?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,663 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sedat SALMAN 12,505 Reputation points
    2024-03-02T14:44:44.0633333+00:00
    • Disable unnecessary policies, especially those meant for XML/JSON data.
    • If using the validate-content policy to ensure your backend produces the correct content type, make sure its configuration doesn't corrupt HTML.
    • Experiment by temporarily disabling security features, caching, or other gateway-level transformations. This helps isolate the root cause.
    • Adjust settings specifically designed for HTML if available.
    • Use a tool like Postman or curl to test your backend directly. Compare the HTML output to what you receive through APIM. This helps determine if the backend is the issue.
    0 comments No comments