question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

isssue with links and basepath

See original GitHub issue

Hi dilip , am facing issue with same zuul but different issue, the swagger is fine as i overrided relative base path , but directly get the objects via curl or other means the base path is still the server context.

eg : zuul proxy - > http://localhost:8890/ega/ampt2d/propRegistry/ application url -> http://localhost:8890/ega/t2d/registry/ overrided host and base path,

return new Docket(DocumentationType.SWAGGER_2)
                .host("localhost:8890")
                .pathProvider(new RelativePathProvider(servletContext) {
                    @Override
                    public String getApplicationBasePath() {
                        return "/ega/ampt2d/propRegistry";
                    }
                })
                .select() 

swagger is fine [ Base URL: localhost:8890/ega/ampt2d/propRegistry ] http://localhost:8890/ega/ampt2d/propRegistry/v2/api-docs

but when i directly access localhost:8890/ega/ampt2d/propRegistry i get

 {
  "_links" : {
    "phenotypes" : {
      "href" : "http://localhost:8890/ega/t2d/registry/phenotypes{?page,size,sort}",
      "templated" : true
    },
    "properties" : {
      "href" : "http://localhost:8890/ega/t2d/registry/properties{?page,size,sort}",
      "templated" : true
    },
    "profile" : {
      "href" : "http://localhost:8890/ega/t2d/registry/profile"
    }
  }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
selvaebicommented, Aug 8, 2018

no i resolved by creating post filter in zuul to replace all the links having context path to relative path.

@Override
    public Object run() {
        try {
            final RequestContext requestContext = RequestContext.getCurrentContext();
            String responseBody = CharStreams.toString(new InputStreamReader(requestContext.getResponseDataStream(), "UTF-8"));
            responseBody = responseBody.replaceAll("/t2d/registry", "/ampt2d/propRegistry");
            RequestContext.getCurrentContext().setResponseBody(responseBody);
        } catch (Exception e) {
            throw new RuntimeException("Error parsing response json");
        }
        return null;
    }

0reactions
stale[bot]commented, Jul 8, 2020

This issue has been automatically closed because it has not had recent activity. Please re-open a new issue if this is still an issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to the Fix Base URL Malformed or Empty Issue
The situation occurs if there is an error in the base tag. It may be caused by incorrect formatting of the base URL,...
Read more >
Base paths (and links) not generating correctly for nested pages.
Base paths (and links) not generating correctly for nested pages. ... Manually inserts basepath until vitepress basepaths issue resolved.
Read more >
React Router base URL issue and link tag issue
Main page is loaded correctly because root component has a path of '/mobile'. But when I try to access thankyou Component using the...
Read more >
links in jira issues should be relative ratherr than use the ...
I have just verified that in the current version (3.10) we are still constructing automatically created links (such as this one - JRA-1...
Read more >
Links in Jira Issue List redirects to Jira base URL ... - GitLab
Navigate to GitLab Issues. Click on Jira issue. Get redirects to a 404 page, the URL shows that it is a Jira base...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found