Getting a 500 response when accessing Categories Index route

AI-generated summary

A user encountered a 500 error when accessing the Categories Index route, traced to an invalid IP address format including a port number (13.86.104.6:3013) in the database update. Gopiraj_Dorairaj identified the issue as Azure Application Gateway appending the port to the HTTP header, which Discourse couldn’t process. codinghorror noted that port numbers are not supported in production. Falco asked about the hosting environment. Gopiraj_Dorairaj confirmed it was hosted on Azure and resolved the issue by configuring the Application Gateway to rewrite HTTP headers, as detailed in Azure’s documentation.

This issue happen’s when after i leave my session idle for a min and refresh.

Not sure why the client ip is having a port value. Is there some config i am missing

Below is the log

Processing by CategoriesController#index as HTML
Redirected to https://forum.doraig.com/login
Filter chain halted as :redirect_to_login_if_required rendered or redirected
Completed 302 Found in 2ms (ActiveRecord: 0.0ms | Allocations: 311)
Job exception: PG::InvalidTextRepresentation: ERROR: invalid input syntax for type inet: “13.86.104.6:3013”
LINE 1: UPDATE “users” SET “ip_address” = ‘13.86.104.6:3013’ WHERE "…

Port numbers are only supported for local development, is this a Development question? No production instance of Discourse will ever work with a custom port, that is not supported.

Are you hosted in azure ?

Yes it is running in azure, I looked at the azure documentation, It was an issue with how azure adds the port number in the http header’s. I was able to resolve this (reference https://azure.microsoft.com/en-ca/blog/rewrite-http-headers-with-azure-application-gateway/). It works now , was an issue with Azure.