public async Task <IActionResult> Wrap(WrapAddressModel model) { var record = await _recordRepo.GetRecordByName(model.RecordName); if (record == null) { return(NotFound()); } if (!record.Enabled) { return(NotFound()); } var builtUrl = BuildTargetUrl(record, model.Path); switch (record.Type) { case RecordType.IFrame: return(View("Iframe", builtUrl)); case RecordType.Redirect: return(Redirect(builtUrl)); case RecordType.PermanentRedirect: return(RedirectPermanent(builtUrl)); case RecordType.ReverseProxy: return(await RewriteToUrl(builtUrl)); default: return(Redirect(builtUrl)); } }
public async Task <IActionResult> Wrap(WrapAddressModel model) { var record = await _recordRepo.GetRecordByName(model.RecordName); if (record == null) { return(NotFound()); } if (!record.Enabled) { return(NotFound()); } var builtUrl = BuildTargetUrl(record, model.Path); return(record.Type switch { RecordType.IFrame => View("Iframe", builtUrl), RecordType.Redirect => Redirect(builtUrl), RecordType.PermanentRedirect => RedirectPermanent(builtUrl), RecordType.ReverseProxy => await RewriteToUrl(builtUrl), _ => Redirect(builtUrl), });