Hello
We’re currently using cloudfront as a reverse proxy to get a custom domain for our apidog public docs.
We’re having two issues.
Our reverse proxy uses:
api.{domain}.io/docs/
And we redirect ../docs to ../docs/
This gives an issue with the logo at the top left of the public documentation tho, it throws a 404 when clicking on it, even though it ends up at the ../docs link.
Our search bar is also throwing a 404 everytime (in the devtools), but works fine when using the “preview” inside apidog. (Were using ‘Local Search’)
Im thinking this is either a apidog bug? Or we have some kind of issue with our reverse proxy, but I doubt it.
Could you please share the link to your documentation so we can investigate the issue?
Thank you for your feedback. We will investigate this issue.
Could you please check if your Nginx location configuration includes the subdirectory? You can refer to our help documentation for guidance Custom Domain - Apidog Docs
It includes the subdirectory, remember that we use cloudfront and not nginx tho
This is the config:
dynamic "ordered_cache_behavior" {
for_each = local.is_prod ? [1] : []
content {
path_pattern = "/docs/*"
target_origin_id = "apidog-docs-origin"
viewer_protocol_policy = "redirect-to-https"
allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "POST", "PATCH", "DELETE"]
cached_methods = ["GET", "HEAD"]
forwarded_values {
query_string = true
cookies {
forward = "all"
}
headers = ["*"]
}
min_ttl = 0
default_ttl = 3600
max_ttl = 86400
}
}
And we have a cloudfront function for redirecting too:
resource "aws_cloudfront_function" "docs_trailing_slash" {
name = "docs-trailing-slash"
runtime = "cloudfront-js-1.0"
publish = true
code = <<EOF
function handler(event) {
var request = event.request;
var uri = request.uri;
if (uri === "/docs") {
return {
statusCode: 301,
statusDescription: "Moved Permanently",
headers: {
"location": { "value": "/docs/" }
}
};
}
return request;
}
EOF
}
Expected outcome: subdirectory should not be included when requests are rewrite to apidog. You can try using CloudFront Functions to remove subdirectory.
