Im trying to proxy a request using go fiber and it just returns the plain html text

364 Views Asked by At

As it says in the title, im proxying a request to a target however it just renders the plain code in the browser instead of properly rendering the webiste.

if proxyPassCookie != hex.EncodeToString(cval) {
        return c.Status(fiber.StatusBadRequest).SendString("ERROR ID: 0001")
    }
    // Cookie exists, act as a reverse proxy

    prequestCounter.Inc()
    return func(ctx *fiber.Ctx) error {
        c.Set(fiber.HeaderContentType, fiber.MIMETextHTML)
        return proxy.Forward(proxyTargetURL)(ctx)
    }(c)

Ive tryed some variations but they either didnt proxy at all or errored straight away cause they are deprecated. Im using go version 1.21.1

0

There are 0 best solutions below