Swaggerui behind tunnel

Hi,
I'm trying to setup xdata server behind cloudflare tunnel. Server works okay, but if I try swaggerui I get error

Fetch error

Failed to fetch http://myserver.skj.fi/api/demodata/openapi/swagger.json

Fetch error

Possible mixed-content issue? The page was loaded over https:// but a http:// URL was specified. Check that you are not attempting to load mixed content.

I tried to add forward middleware but it didn't help.

Requests header have
GET https://myserver.skj.fi/api/demodata/swaggerui HTTP/1.1
Host: myserver.skj.fi

in javascriptcode generated by xdataserver ( i assume) url is
var url = "http://myserver.skj.fi/api/demodata/openapi/swagger.json"

It really depend on how Cloudflare is sending the forward headers. Are you able to inspect the request headers from Cloudflare?
The forward middleware should solve it properly if the headers are "standard".
Have you also properly used the OnAcceptProxy to accept the CloudFlare proxy?
Finally, you can always use OnGetAbsoluteUrl event to go the brute force and change the URL manually (add the https): Swagger API service problem when using HTTPS URL - XData SwaggerUI - XDataServerModule - #16 by wlandgraf

1 Like

That helped, thanks a lot.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.