Swagger page has uncaught exceptions flask restplus - docker

I have a flask restplus app which has an API page documented in a swagger interface.
This page comes up happily and I can use it when it is run locally.
I have it working inside a docker container with the ProxyFix from WerkZeug. However when I put that container behind an nginx instance, I get Uncaught SyntaxError: Unexpected token '<' on swagger-ui-bundle.js . Clicking through it's indeed correct as what is being attempted to be rendered as swagger-ui-bundle.js is in fact a page of HTML, and that > is the first character of the page.
So what's going on?
How do I fix it to get the swagger page come up?
EDIT:
Turns out that the swagger was being served from /swagger, not url_prefix/swagger. This meant that the nginx config was forwarding the request to an angular front end running from /, which was serving up the html front page and not the js that was expected.
So, the solution to this is to move the swagger to be served from http://<ip>/swagger to http://<ip>/my_site/swagger. I've tried a bunch of solution but can't get any of them to serve up the swagger from anywhere but http://<ip>/swagger, which isn't helpful (and no, hardcoding the nginx config isn't the right solution as we have multiple services using potentially different versions)
So if anyone has an idea how to do that that would be amazing.

Related

Access to a PDF File in a http with dinamyc variables

Hello everyone (sorry for bad English), i'm getting crazy with this problem... i'm working on a project with NiFi expecting to download PDF files from a public Goverment page. The main problem it's that the page you request in a web browser shows the correct page like this
Asking the same page in NiFi (also testing in postman) shows that the session has expire, then looking at the HTTPS POST with the development tools in chrome i notice that there are multiple headers that contain dynamic variables
Is there any form to replicate web browser behaviour on NiFi?

Rails app served under url segment behind ingress

I am looking for ideas on how to solve the following problem. I want to serve a rails app under an URL segment. The path to the rails app will be https://example.com/app. The landing page https://example.com/ will be bunch of static HTML, CSS, and javascript.
This will be handled by ingress in a kubernetes cluster. Ingress is easy, I have all that configuration ready but the problem as I see it is how to handle redirects between Location /app and Location /.
Is there anything in rails that prevents this? Is it just a matter of trial and error?

AKS Ingress navigating to a URL path returns a 404, url changes to the index.html which is the correct route?

within my ingress file i have a path set up to navigate to my app, that routes to an application,
when i go to myingresIp/pss it redirects to myingresip/index.html, so it is almost like the routing is working its just not hitting my app.
I feel like the URL still needs to keep the /app prefix.
Can any one see what could be causing this problem or suggest a way of debugging this i am pretty new to AKS/kubernetes, or if there is some kind of logs that i can access to see what the underlying issue is?
Yaml:
The page i get then i navigate to myingresIp/pss is:
pod data:

JRuby/tomcat 404 errors in rseponse to ajax GET

This problem appears specific to routing for JRuby ajax requests. My page sends an ajax GET which works fine in rails development mode. When moved to tomcat via warbler, the request is generated correctly, but tomcat responds with a 404 error.
In other words, the line in routes.rb get '/sector/method' is sufficient that http://localhost:3000/sector/method is processed by Webrick, but if I change the port to 8080 (tomcat) I get a HTTP status 404 The requested resource (/sector/method) is not available.
Apparently tomcat needs to be told it is OK to process the GET even though there is no corresponding file to be found. Right? Fixes?
Thanks.
Are you sure your request point to correct address? if application works, there is no way that GETs does not. Please try to put the request directly into your browser and check...

Why is meta refresh redirect no longer working and how can I fix it?

Thanks in advance for any help you can provide!
I have a website built in Ruby on Rails. My site has a webpage, located at example.com/communityboard, that you can use to enter a separate Community area (an off-the-shelf bulletin board called bbPress.)
I want users who type in the URL example.com/community to be redirected to example.com/communityboard . It used to work this way, but for some reason, the redirect no longer works in any browser but IE.
We accomplished this redirect by placing an index.html file in the /community folder where bbPress had been installed. The entire code for the index.html file reads
<meta http-equiv="refresh" content="0;url=http://example.com/communityboard">
Back when we built the site, I was told that a meta refresh redirect using an index.html file was the best option. The redirect had to address ONLY a single page (http://example.com/community) and not all of the sublevels of the community bb (which lives at http://example.com/community/index.php). Otherwise, the community bb and all of its sublevels would be redirected.
So... my questions:
Why is the meta refresh redirect not working anymore?
How can I fix it?
Thanks again for any help you can offer!
If it's only working in IE, it's possible there's a script or parsing issue that's breaking other browsers. I would run the HTML through a validator like http://validator.w3.org/.
Meta-refresh is a legacy practice that is now discouraged -- the wikipedia entry contains more info and links to alternative solutions: http://en.wikipedia.org/wiki/Meta_refresh.
Here's what happened according to my developer. I don't fully understand the explanation, so I'm not sure I can answer follow-up questions! "With the old mongrel cluster, Apache would recognize "/community" as a directory, silently forward to "/community/", which would then pick up the forwarding index.html file. With Phusion Passenger," which I guess we're using now, "Apache sends the request directly to Passenger if "/community" is not a regular file, and Passenger was returning the 404 error. As a fix, we've disabled passenger in the community folder, which fixes the problem."

Resources