mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
How do I access admin endpoints if WireMock.Net is hosted behind AWS application load balancer? #612
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rui-ktei on GitHub (Jul 2, 2024).
Originally assigned to: @StefH on GitHub.
Hello,
Right now, all the admin paths are hardcoded as
/__admin/*. But if I host this server behind AWS ALB, when I set up a listener rule, I usually specify a route prefix so that the ALB knows how to distribute traffic to the correct container. In that case, the requests coming through will all carry route prefix, say,/myprefix, and then the built-in admin endpoints will not work because/myprefix/admin/*does not exist.Here is the code I found where admin paths are hardcoded: https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net/Server/WireMockServer.Admin.cs
Could you tell me if what I understand so far is correct and if so, will there be any solution to it?
Thank you!
@StefH commented on GitHub (Jul 2, 2024):
@rui-ktei
Your understanding is correct.
The solution would be to replace the hardcoded admin paths with configurable admin paths. I need to look into that.
@rui-ktei commented on GitHub (Jul 2, 2024):
@StefH Thank you for looking into that! Do you have a roadmap such as when you think it could be supported in the next release? The reason I'm asking is because I'm struggling to decide whether I should wait for the offical fix or fork this repository.
@luap-podium commented on GitHub (Jul 2, 2024):
@rui-ktei I just came across the same problem today but in my case GCP LB. I was able to add a
rewriteTarget: "/"to the ingress spec so the service path is matched then replaced with the slash when forwarded on.I'm not sure if this is supported in AWS ALB these days (or something similar) but thought I'd mention if useful.
@StefH commented on GitHub (Jul 2, 2024):
https://github.com/WireMock-Net/WireMock.Net/pull/1130
@StefH commented on GitHub (Jul 2, 2024):
@rui-ktei
A PR is in progress, you can take a look if you want.
And I guess you will also need a new Docker image version?
@rui-ktei commented on GitHub (Jul 3, 2024):
@StefH Thank you so much! I use the standalone version to build my own docker image so technically I won't use the official docker image.
@rui-ktei commented on GitHub (Jul 3, 2024):
@luap-podium Thank you for your comment. Unfortunately as far as I know, AWS ALB doesn't have the same feature as GCP, which seems to be a way smarter LB. But anyways, the author is very kind to open a PR to implement my feature request. I guess I'll just wait until that PR is merged.
@StefH commented on GitHub (Jul 3, 2024):
If you use the standalone NuGet, you can try preview
1.5.59-ci-18863(see https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)An
AdminPathproperty has been added to the WireMockServerSettings class.@StefH commented on GitHub (Jul 8, 2024):
@rui-ktei
Were you able to test this?
@rui-ktei commented on GitHub (Jul 9, 2024):
Hi, I did download the preview package and it worked fine for me. I'm just waiting for the official release now 🙂
@StefH commented on GitHub (Jul 9, 2024):
Good to hear.
New version will be released this afternoon.